Hello all. I re-post this question by e-mail. (I posted via google-group. But It's not posted yet.)
I'm newbie GNU R. I would like to compare two datas. How to select columns which has non-zero datas?. It it possible to create the data frame only VAL3(non-zero data) column with command? Formatted sample. https://gist.github.com/hiroyuki-sato/cb36584f6cd5845b6c3e sample1.txt ID,VAL1,VAL2,VAL3 ID1,0,2,3 ID2,0,2,3 ID3,0,2,3 real data has 5000 columns. sample2.txt ID,VAL1,VAL2,VAL3 ID1,0,2,3 ID2,0,2,3 ID3,0,2,2 The difference sample1 and sample2 is ID3/VAL3. sample1: 3 sample2: 2 R commands. sample1 <- read.table("sample1.txt",header=T,sep=',') sample2 <- read.table("sample2.txt",header=T,sep=',') result <- sample1[,2:4] - sample2[,2:4] result VAL1 VAL2 VAL3 1 0 0 0 2 0 0 0 3 0 0 1 I would like to create data frame which has non-zero value columns. Could you tell me how to do it? Best regards. -- Hiroyuki Sato. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.