lm.fit中的错误(x,y,偏移=偏移,singular.ok = singular.ok,...)0非na情况(换羽包)

时间:2016-04-10 20:59:03

标签: r

我是R的新手,并且不太了解它是如何运作的。我尝试运行此代码但是lm.fit中的"错误(x,y,偏移=偏移,singular.ok = singular.ok,...):0(非NA)情况& #34;不断出现,我的数据实际上没有NA。那我该怎么办?

> library("moult")
> 
> mym = read.csv("Test.csv", sep=";", head=T)
> head(mym)
    Age Sex  MoultPresence      Score Prim Habitat Jul.Day
1 Adult   1             1 5554210000   22   Beach     123
2 Adult   2             1 5555321000   26 Estuary     124
3 Adult   1             1 5555553200   35 Estuary     124
4 Adult   1             1 4440000000   12   Beach     126
5 Adult   2             1 5555532100   31 Mudflat     127
6 Adult   1             1 5555321000   26 Mudflat     127

> if (is.numeric(mym$Prim)) {scores <- format(mym$Prim, scientific = FALSE, trim = TRUE)} else {scores <- mym$Prim}
> mscores <- substr(scores, 1, 9)
> mym$Date <- date2days(mym$Date, dateformat = "dd-mm-yyyy", startmonth = 9)
> m88.2 <- moult(Prim ~ Jul.Day, data = mym)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  0 (non-NA) cases

> summary(m88.2)
Error in summary(m88.2) : object 'm88.2' not found

> m88c <- moult(Prim ~ Jul.Day, data = mym, type = 3)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  0 (non-NA) cases

> summary(m88c)
Error in summary(m88c) : object 'm88c' not found

> durationmean2ab <- function(duration, mean) {
+   ab <- c(-mean/duration, 1/duration) 
+   names(ab) <- c("intercept", "slope") 
+   return(ab) 
+ }
> uz1 <- durationmean2ab(coef(m88c, "duration"), coef(m88c, "mean"))
Error in coef(m88c, "mean") : object 'm88c' not found

> 
> ssex <- ifelse(mym$Sex == 1 | mym$Sex == 3, "male", ifelse(mym$Sex == 2 | mym$Sex == 4, "female", NA))
> mym$ssex <- as.factor(ssex)
> mmf <- moult(Prim ~ Jul.Day | ssex | ssex, data = mym, type = 3)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  0 (non-NA) cases

你们有没有人知道如何解决它?

0 个答案:

没有答案