Displaying 3 results from an estimated 3 matches for "data_tmp".
2011 Mar 09
4
Help with read.csv
...,
1/1/2006,1,3393.9,3412,76.65,105.04,,
1/1/2006,2,3173.3,3202,69.20,67.67,,
1/1/2006,3,3040.0,3051,69.20,77.67,,
1/1/2006,4,2998.2,2979,67.32,69.10,,
1/1/2006,5,3005.8,2958,65.20,68.34,,
where the ',' is the separator and I tried to read it into R, but...
> y <- read.csv("Data/Data_tmp.csv", header = FALSE, skip = 1,
+ colClasses = c("character", "int", rep("double", 4)),
+ col.names = c("Date","Hour","DA_DMD","DMD","DA_RTP", "RTP"),
+ flush = T...
2008 Sep 14
4
Fetching a range of columns
Hello,
I realize that using: x[x > 3 & x < 5] I can fetch all elements between 3
and 5. However I read in from a CSV file, and I would like to fetch all
columns from within a range ( 842-2411). In teh past, I have done this to
fetch just select few columns:
data <- read.csv(filein, header=TRUE, nrows=320, skip=nskip)
data_filter <- data[c(2,12,17)]
2017 Dec 14
1
Aggregation across two variables in data.table
...his is straightforward:
Demo_names <- c("Age", "Education", "Marital", "Familysize", "Income",
"Housing")
means1 <- as.list(rep(0, length(Demo_names)))
for (i in 1:length(Demo_names)) {
Demo_tmp <- Demo_names[i]
means1[[i]] <- data_tmp[,list(mean(Theta)),by=Demo_tmp]}
Is there an easy way to extent this logic to more than 1 variable? I know
how to do this manually, e.g.,
data_tmp[,list(mean(Theta)),by=list(Marital, Education)]
But I don't know how to integrate this into a loop.
Thanks,
Michael
[[alternative HTML version...