我正在从 xlsx ( https://www.dropbox.com/s/r5sn5pio5rnprdq/gesammelte%20Daten_1707.xlsx ) 文件中导入数据read.xlsx
setwd("C:/***//Kultivierungen//1707_ADH//")
pH <- read.xlsx("gesammelte Daten_1707.xlsx", sheetName="pH")
OD <- read.xlsx("gesammelte Daten_1707.xlsx", sheetName="OD")
Glc <- read.xlsx("gesammelte Daten_1707.xlsx", sheetName="Glucose")
Ac <- read.xlsx("gesammelte Daten_1707.xlsx", sheetName="Acetate")
我想删除NA
值
OD <- OD[rowSums(is.na(OD))==0,]
Glc <- Glc[rowSums(is.na(Glc))==0,]
Ac <- Ac[rowSums(is.na(Ac))==0,]
pH <- pH[rowSums(is.na(pH))==0,]
..这适用于OD
andpH
数据,但不适用于Ac
and Glc
。删除NA
值之前的结果如下所示:
time.in.h SPL1 SPL1_Error SPL2 SPL2_Error SPL3 SPL3_Error
1 0.000000 <NA> <NA> <NA> <NA> <NA> <NA>
2 1.502222 <NA> <NA> <NA> <NA> <NA> <NA>
3 3.687778 0.0602636534839925 0.06 0.0502197112366604 0.09 0.0301318267419962 0.03
4 10.248889
5 16.248333 0.118460019743337 0.06 0.0829220138203356 0.12 0.106614017769003 0.18
6 21.653056 0.0644511581067472 0.03 0.0161127895266868 0.15 0.0483383685800604 0.12
7 29.653333
8 37.652778
9 43.391667 0.342347696879643 0.18 0.271025260029718 0.18 0.727488855869242 0.24
在删除NA
值之后..:
time.in.h SPL1 SPL1_Error SPL2 SPL2_Error SPL3 SPL3_Error
3 3.687778 0.0602636534839925 0.06 0.0502197112366604 0.09 0.0301318267419962 0.03
4 10.248889
5 16.248333 0.118460019743337 0.06 0.0829220138203356 0.12 0.106614017769003 0.18
6 21.653056 0.0644511581067472 0.03 0.0161127895266868 0.15 0.0483383685800604 0.12
7 29.653333
8 37.652778
9 43.391667 0.342347696879643 0.18 0.271025260029718 0.18 0.727488855869242 0.24
str()
返回以下内容:
> str(Glc)
'data.frame': 9 obs. of 17 variables:
$ time.in.h : num 0 1.5 3.69 10.25 16.25 ...
$ SPL1 : Factor w/ 5 levels "","0.0602636534839925",..: NA NA 2 1 4 3 1 1 5
$ SPL1_Error: Factor w/ 4 levels "","0.03","0.06",..: NA NA 3 1 3 2 1 1 4
$ SPL2 : Factor w/ 5 levels "","0.0161127895266868",..: NA NA 3 1 4 2 1 1 5
$ SPL2_Error: Factor w/ 5 levels "","0.09","0.12",..: NA NA 2 1 3 4 1 1 5
在使用不同的数据/xlsx 文件集之前它运行良好,我也尝试排除 xlsx 文件中的所有格式问题,但找不到任何东西......以前有人有过吗?