[Solved] Multiple aggregation in R with 4 parameters

You could try something like this in data.table data <- data.table(yourdataframe) bar <- data[,.N,by=y] foo <- data[x==1 & z==1,list(mean.t=mean(t,na.rm=T),median.t=median(t,na.rm=T)),by=y] merge(bar[,list(y)],foo,by=”y”,all.x=T) y mean.t median.t 1: 1 12.5 12.5 2: 2 NA NA 3: 3 NA NA 4: 4 NA NA You probably could do the same in aggregate, but I am not sure you can do … Read more

[Solved] Using R – Read CSV , aggregate/percent column

The first step (reading in the csv) is pretty simple: data = read.table(“filename.csv”, sep = “,”, quote = “”, header=TRUE) The ‘sep’ part makes it clear that the separator is a comma, and ‘header’ keeps those column headings separate from the rest of the data. Does that work for you? -Y solved Using R – … Read more