search for: outputlist

Displaying 2 results from an estimated 2 matches for "outputlist".

2011 Nov 10
2
Removing numbers from a list
I am using gsub to remove numbers for each element of a list. Code is given below. testList <- list("this contains a number 1000","this does not contain") removeNumbers <- function(X) { gsub("\\d","",X) } outputList <- lapply(testList,removeNumbers) However, when I try to find the number of words in outputList as follows outLength <- lapply(strsplit(outputList," "),length) it throws out the following error: Error in strsplit(outputList, " ") : non-character argument Can some...
2016 Apr 07
2
Storing output of loop into list()
...th(ttind)) { print(round(temps[ttind[ti]:(ttind[ti]+9)],3)) } My (failed) soultion attempt: temps<-rnorm(400,14,0.05) ttind<-NULL for(ti in 1:(length(temps)-9)) { if(temps[ti]-temps[ti+9] >= 0.1 && max(temps[ti]-temps[ti+1:9]) > -0.05) ttind<-c(ttind,ti) } outputList = list() counter = 1 for(ti in 1:length(ttind)) { outputList[i] <- print(round(temps[ttind[ti]:(ttind[ti]+9)],3)) counter= counter+1 } print(outputList) [[alternative HTML version deleted]]