R (programming language)

wikipedia

Regression Modeling with Actuarial and Financial Applications (Jed Frees)
Learn R: http://instruction.bus.wisc.edu/jfrees/jfreesbooks/Regression%20Modeling/Book…

via en.wikipedia.org
http://wiki.stdout.org/rcookbook/
Quick R (incl Timeseries, Forecasting)
http://www.statmethods.net/advstats/timeseries.html
http://wiki.stdout.org/rcookbook/Basics/Getting%20a%20subset%20of%20a%20data%…
Set Work Directory
!!! use forward slash instead of backward slash in path name
setwd(“C:/Users/cw13/Documents/bianalyst/20120513 Learning R”)

Read File into R (Matrix, chosen name “data”)

DisplayData
Display Row 103-107, Columns 3-7
> data[103:107,3:7]
Display Row 1-4, Columns 2 and 7
> data[1:4,c(2,7)]
V2  V7
1  – 200
2  – 200
3  – 404
4  – 200
Display data type
> is.factor(data[,1])
[1] TRUE
> length(data[,9])
[1] 185
> summary(data[,10])
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA’s
4.700   7.000   7.400   7.397   7.800   9.100       1
> plot(density(data[,9]))
Plot Histogram
> hist(data[,10],
+ plot=T, xlab=”IMDB user rating”,ylab=”number of movies”, main=”IMDB”,
+ col=”blue”)
Barplot
barplot(diff, col=”red” , horiz=TRUE, space=0, add=TRUE, axes=FALSE)Plot
plot(data[,9], data[,10]
, xlab=”your rating”, ylab=”imdb rating”, main=”Where IMDB is wrong!”, sub=”acc 2 me”
, col=”green”, type=”p”
, xlim=c(0,10), ylim=c(0,10)plot(data$You.rated, data$IMDb.Rating, xlim=c(0,10), ylim=c(0,10),pch=19)
legend(110,.25,c(“Exam 1″,”Exam 2”),
col=c(“black”,”blue”),lty=c(2,1),pch=19)> plot(x,y, xlim=c(0,10), ylim=c(0,10))
> text(x[diff>2.4],y[diff>2.4],labels=data$Title, adj=1)
> plot(x,y, xlim=c(0,10), ylim=c(0,10))
> abline(0,1)
> abline(myline.fit)
ECDF

> plot(ecdf(data$You.rated))
> lines(ecdf(data$IMDb.Rating), col=”red”)

BOXPLOT

boxplot(data[,9],data[,10],col=”blue”,
names=c(“my rating”,”imdb rating”),ylab=”rating”)

SCATTERPLOT 3D

install.packages(“scatterplot3d”)
library(scatterplot3d)

Attention: y-axis is the new z-axis here
scatterplot3d(
data$You.rated, data$Num..Votes, data$IMDb.Rating
, xlab=”My Rating”, zlab=”IMDB Rating”, ylab=”Number of Votes”
, xlim=c(0,10), zlim=c(0,10)
)

Print to File
bmp(filename=”scatter3d.bmp”)

correlaton
> cor(data[,9], data[,10], use=”complete.obs”)

FTABLE

data<-read.csv(“C:/Users/cw13/Documents/bianalyst/20110801 parteispenden/parteispenden.csv”,sep=”,”,header=T)

ftable(data[,2]~data[,1], ylab=”Spende(EUR)”, main=”Parteispenden”)

JSON –> R

Media_httpcontentscre_ykfej

Computing for Data Analysis

Week 1

Week 2

Week 3

Week 4

  • Objected oriented programming
  • Data abstraction
  • Regular expressions
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s