Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread arun
HI, If I understand correctly, you could also try: set.seed(48)  d2 <- as.data.frame(matrix(sample(c("",letters[1:2]),26*245,replace=TRUE),26,245))  d2[3,] <- ""  names1 <-paste0("V",13:239) res <- d2[rowSums(d2[,names1]=="") < ncol(d2[,names1]),names1] A.K. On Thursday, January 2, 2014 1:20

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Gerrit Eichner
O-ha, sorry, Luca, I mixed up arguments: it shouldn't be "subset" but "select". apply( subset( d2, select = V13:V239), 1, function( x) any( x != "")) should work. "Auf Wiederhören!" ;-) Regards -- Gerrit On Thu, 2 Jan 2014, Luca Meyer wrote: Hi Gerrit, Thank you for the suggestion. Un

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Luca Meyer
Hi Jim, Thank you, it works indeed :) Luca 2014/1/2 Jim Lemon > On 01/02/2014 05:17 PM, Luca Meyer wrote: > >> Happy new year fellows, >> >> I am trying to do something I believe should be fairly straightforward but >> I cannot find my way out. >> >> My dataset d2 is 26 rows by 245 columns, e

Re: [R] How to verify char variables contain at least one value

2014-01-01 Thread Gerrit Eichner
Hello, Luca, also a happy new year! It's not quite clear to me what you want to do, but note first that the ":"-operator is a short-cut for seq() with by = 1 (look at ?seq), and that it usually (!) does not work on columns of data frames. Exception: when used for the argument subset of functi

Re: [R] How to verify char variables contain at least one value

2014-01-01 Thread Jim Lemon
On 01/02/2014 05:17 PM, Luca Meyer wrote: Happy new year fellows, I am trying to do something I believe should be fairly straightforward but I cannot find my way out. My dataset d2 is 26 rows by 245 columns, exclusively char variables. I would like to check whether at least one column from V13

[R] How to verify char variables contain at least one value

2014-01-01 Thread Luca Meyer
Happy new year fellows, I am trying to do something I believe should be fairly straightforward but I cannot find my way out. My dataset d2 is 26 rows by 245 columns, exclusively char variables. I would like to check whether at least one column from V13 till V239 (they are in numerical sequence) h