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.
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.
Keep observations where brand = Sony and discard other observations.
newdata <- olddata[ which(olddata$brand=='Sony'), ]
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
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.
One line:
mydata <- read.table ('c:\\users\\me\\data\\myfile.csv', sep=",")
From Coruscation's r: r in a day.