我的数据以特定方式排列,没有标题,并且列不一定包含相同类型的信息。它的一部分可以使用:
data <- textConnection("rs123,22,337647,C,T
1,7385,0.4156,-0.0019,0.0037
1,16550,0.959163800640972,-0.0241,0.0128
1,17218,0.0528,0.015,0.039
rs193,22,366349,C,T
1,7385,0.3708,0.0017,0.0035
1,16550,0.793259111116741,-0.0028,0.009
1,17218,0.9547,-0.016,0.033
rs194,22,366300,NA,NA
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
rs118,22,301327,C,T
1,7385,0.0431,-0.0085,0.0077
1,16550,0.789981059331214,0.0036,0.0092
1,17218,0.99,-0.057,0.062
rs120,22,497528,C,G
1,7385,0.0716,0.0012,0.0073
1,16550,0.233548238634496,-0.0033,0.0064
1,17218,0.4563,-0.002,0.015
rs109,22,309825,A,G
1,5520,0.8611,2e-04,0.0044
0,0,0,0,0
1,17218,0.9762,0.076,0.044
rs144,22,490068,C,T
0,0,0,0,0
0,0,0,0,0
1,17218,0.2052,-0.013,0.032")
mydata <- read.csv(data, header = F, sep = ",", stringsAsFactors=FALSE)
我的问题是这样的:我可以写一行到 grep/awk 包含“NA”的行(这些是不包含数据的 SNP)
grep -v 'NA' file.in > file.out
但是,我怎样才能同时指定以下 3 行也被删除?我不想删除包含全零的每一行,只删除包含所有零的行,这些行跟随包含带有“NA”的 SNP 的行。
谢谢您的意见!