真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

R語言移除缺失值NA

有三種方法  !is.na  , na.omit, complete.cases

創(chuàng)新互聯(lián)建站是一家專注于成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計與策劃設(shè)計,巨野網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:巨野等地區(qū)。巨野做網(wǎng)站價格咨詢:028-86922220

> d <- read.table("GWAS_s2.qassoc", header=T, stringsAsFactors=F)  

// 文件行數(shù)
> nrow(d)
[1] 431493

> d1 <- subset(d, select=c("CHR", "SNP", "BP", "P"))  

// 計算非NA 的行數(shù)

> num.bool <- complete.cases(d1)
> head(num.bool)
[1] FALSE  TRUE  TRUE FALSE  TRUE  TRUE  

> sum(num.bool) 
[1] 363836                                                                                                            
                                                                                                                            
> dn1 <- d1[which(!is.na(d1$P)),]                                                                                                                                                 
> nrow(dn1)                                                                                                                                                                       
[1] 363836

> dn2 <- na.omit(d1)
> nrow(dn2)                                                                                                                                                            
[1] 363836

> dn3 <-d1[complete.cases(d1[,4]),]                                                                                                                                               
> nrow(dn3)                                                                                                                                                                      
[1] 363836


> dn4 <-d1[complete.cases(d1),]                                                                                                                                                  
> nrow(dn4)
[1] 363836

方法三和方法四, 一個是根據(jù)第四列是否為NA判斷的, 一個是根據(jù)所有列。


名稱欄目:R語言移除缺失值NA
鏈接URL:http://weahome.cn/article/peicgg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部