search for: anslist

Displaying 1 result from an estimated 1 matches for "anslist".

Did you mean: analist
2007 Oct 15
1
The "condition has length > 1" issue for lists
I have the following code: list1 <- list() for (i in list.files(pattern="filename1")){ x <- read.table(i) list1[[i]] <- x } list2 <- list() for (i in list.files(pattern="filename2*")){ x <- read.table(i) list2[[i]] <- x } anslist <- vector('list', length(list1)) for(i in 1:length(list1)) if (list1[[i]] & list2[[i]] >1) anslist[[i]] <- list1[[i]] - list2[[i]] That, if at least one element in either of the lists is below 1, nothing happens. I now get the warning message "the condition has length &...