Good afternoon,
I have been having a problem for quite sometime now with dealing with some missing data in my code. A lot of people I have talked to tell me to simply put "na.strings="."" in the beginging of the code and put "."s in the missing spots. I have done this and I still cannot seem to get it to run.
Data:
Year | Plot | DateTreatment | Rep | Treat | 0WAT | 1WAT | 2WAT | 3WAT |
---|---|---|---|---|---|---|---|---|
2019 | 51 | Apr | 1 | Controlled | 9 | 9 | 9 | 8 |
2019 | 52 | Apr | 1 | Less Fraze | 1 | 5 | 8 | 8 |
2019 | 53 | Apr | 1 | Scalped | 2 | 4 | 6 | 5 |
2019 | 54 | Apr | 1 | Deep Fraze | 1 | 1 | 1 | 2 |
2019 | 55 | Apr | 1 | Gly | 9 | 8 | 7 | 6 |
2019 | 56 | Apr | 1 | Rim | 8 | 8 | 8 | 7 |
2019 | 61 | Apr | 2 | Less Fraze | 1 | 6 | 8 | 8 |
2019 | 62 | Apr | 2 | Deep Fraze | 1 | 2 | 4 | 6 |
2019 | 63 | Apr | 2 | Scalped | 1 | 3 | 7 | 7 |
2019 | 64 | Apr | 2 | Gly | . | . | . | . |
2019 | 65 | Apr | 2 | Controlled | 9 | 9 | 9 | 9 |
2019 | 66 | Apr | 2 | Rim | 8 | 9 | 7 | 6 |
2019 | 71 | Apr | 3 | Gly | 9 | 7 | 7 | 5 |
2019 | 72 | Apr | 3 | Deep Fraze | 1 | 3 | 3 | 5 |
2019 | 73 | Apr | 3 | Less Fraze | 2 | 6 | 7 | 8 |
2019 | 74 | Apr | 3 | Scalped | 3 | 5 | 7 | 6 |
2019 | 75 | Apr | 3 | Rim | 9 | 9 | 7 | 7 |
2019 | 76 | Apr | 3 | Controlled | 9 | 8 | 8 | 8 |
2019 | 81 | Apr | 4 | Gly | 9 | 9 | 7 | 7 |
2019 | 82 | Apr | 4 | Controlled | 9 | 9 | 9 | 9 |
2019 | 83 | Apr | 4 | Deep Fraze | 1 | 2 | 3 | 4 |
2019 | 84 | Apr | 4 | Rim | 9 | 9 | 7 | 7 |
2019 | 85 | Apr | 4 | Less Fraze | 1 | 4 | 7 | 7 |
2019 | 86 | Apr | 4 | Scalped | 2 | 5 | 5 | 5 |
2019 | 91 | May | 1 | Deep Fraze | 1 | 1 | 2 | 3 |
2019 | 92 | May | 1 | Scalped | 5 | 4 | 8 | 6 |
2019 | 93 | May | 1 | Gly | . | . | . | . |
2019 | 94 | May | 1 | Controlled | 8 | 8 | 8 | 8 |
2019 | 95 | May | 1 | Rim | 8 | 8 | 7 | 6 |
2019 | 96 | May | 1 | Less Fraze | 1 | 1 | 4 | 4 |
2019 | 101 | May | 2 | Controlled | 8 | 9 | 8 | 7 |
2019 | 102 | May | 2 | Less Fraze | 2 | 1 | 4 | 6 |
2019 | 103 | May | 2 | Rim | 9 | 9 | 7 | 6 |
2019 | 104 | May | 2 | Scalped | 2 | 3 | 5 | 6 |
2019 | 105 | May | 2 | Gly | 8 | 6 | 3 | 4 |
2019 | 106 | May | 2 | Deep Fraze | 1 | 1 | 2 | 3 |
2019 | 111 | May | 3 | Scalped | 5 | 4 | 5 | 6 |
2019 | 112 | May | 3 | Rim | 8 | 8 | 7 | 6 |
2019 | 113 | May | 3 | Gly | 8 | 5 | 2 | 2 |
2019 | 114 | May | 3 | Controlled | 9 | 9 | 9 | 9 |
2019 | 115 | May | 3 | Deep Fraze | 1 | 1 | 2 | 2 |
2019 | 116 | May | 3 | Less Fraze | 1 | 1 | 6 | 4 |
2019 | 121 | May | 4 | Less Fraze | 1 | 2 | 5 | 6 |
2019 | 122 | May | 4 | Gly | 9 | 4 | 2 | 2 |
2019 | 123 | May | 4 | Rim | 9 | 8 | 7 | 5 |
2019 | 124 | May | 4 | Controlled | 9 | 9 | 8 | 8 |
2019 | 125 | May | 4 | Deep Fraze | 1 | 3 | 6 | 5 |
2019 | 126 | May | 4 | Scalped | 4 | 5 | 6 | 5 |
Code:
setwd("/Users/mc1499/Documents/Thesis Measurements/2018 & 2019 Spring")
dat<-read.csv("TQR pooled.csv")
head(dat)
na.strings="."
block<-as.factor(dat$Rep)
trt<-as.factor(dat$Treat)
trtdate<-as.factor(dat$DateTreatment)
yr<-as.factor(dat$Year)
str(dat)
RCI0WAT<-lme(X0WAT ~ Treat*DateTreatment,random = ~1|Year/Rep,data=dat)
anova(RCI0WAT)
predictmeans(RCI0WAT,"Treat:DateTreatment",pairwise=TRUE)
Output:
RCI0WAT<-lme(X0WAT ~ Treat*DateTreatment,random = ~1|Year/Rep,data=dat)
Error inrownames<-
(*tmp*
, value = rownames(Fitted) <- origOrder) : attempt to set 'rownames' on an object with no dimensions In addition: Warning message: In Ops.factor(y[revOrder], Fitted) : β-β not meaningful for factors
How do I make this run? When I take away the "."s and add any numbers it runs and gives me the results.