Displaying 2 results from an estimated 2 matches for "namevector".
Did you mean:
datevector
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
...pped at: 83.22 0.12 84.49 NA NA
The same thing happens with using tapply with a named vector such as:
tapply(actTime, chainId, function(x) x)
Using the following function with a for loop accomplishes the job in a few
seconds for all 70,000+ records:
> splitWithNames <- function(dataVector, nameVector, factorVector){
+ dataList <- split(dataVector, factorVector)
+ nameList <- split(nameVector, factorVector)
+ listLength <- length(dataList)
+ namedDataList <- list(NULL)
+ for(i in 1:listLength){
+ x <- dataList[[i]]
+ names(x) <- nameList[[i]]...
2011 Oct 04
3
How to subset() from data frame using specific rows
I have a data frame called chemdata with this structure:
> str(chemdata)
'data.frame': 14886 obs. of 4 variables:
$ site : Factor w/ 148 levels "BC-0.5","BC-1",..: 104 145 126 115 114 128 124 2 3 3 ...
$ sampdate: Date, format: "1996-12-27" "1996-08-22" ...
$ param : Factor w/ 8 levels "As","Ca","Cl",..: