Main

May 14, 2015

How long did it take to run ? system.time in r r in day #6



system.time(mydata_2MM <- read.table('~/Desktop/data/bifile.csv', sep=",", nrows=20000000))

user system elapsed
829.317 201.972 2065.421

Coruscation's r in a day #6.

May 2, 2015

Subset data some observations: which[, r in a day #5


Keep observations where brand = Sony and discard other observations.

newdata <- olddata[ which(olddata$brand=='Sony'), ]


Coruscation's r in a day.

November 30, 2014

See first 10 observations in a data set: head, r in a day #4

head prints the top ( first observations or lines) of a data set.

head(dataset_name, n=10)

X1 X2 X3
a 2 4
b 2 4
c 1 3
c 1 2
c 2 2
...
e 4 5

Coruscation's r in a day.

February 17, 2014

r in a day #3: More Convert CSV to data set by reading as text file, in r

Get variable names, read only some rows

mydata <- read.table ('c:\\users\\me\\data\\myfile.csv',
header=FALSE,
sep=",",
nrows=1000)



Q. Is the first row the vriable names and all following rows data ?

No, all rows are data: header=FALSE

Yes. header=TRUE

From Coruscation's r: r in a day.

February 8, 2014

r in a day #2: Convert CSV to data set by reading as text file, in r

One line:



mydata <- read.table ('c:\\users\\me\\data\\myfile.csv', sep=",")


From Coruscation's r: r in a day.

November 9, 2013

r a day #1: ls() lists datasets in the workspace



Q #1. What data do I already have in my r workspace ?

A #1.

ls()

r - r in a day.