-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hi Dr Keon, awesome package! , I just found a bug when one of the contrasts is all set to NA,
see these two examples:
> my.df <- data.frame(a=as.integer(1:9),
group=factor(c(rep("A",2),rep("B",7))),
b=c(runif(2),rep(NA,7)));my.df
a group b
1 1 A 0.9005048
2 2 A 0.4966779
3 3 B NA
4 4 B NA
5 5 B NA
6 6 B NA
7 7 B NA
8 8 B NA
9 9 B NA
> mytable(group~.,data=my.df)
Error in lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok, :
NA/NaN/Inf in 'x'
>
>
>
>
> my.df <- data.frame(a=as.integer(1:9),
group=factor(c(rep("A",2),rep("B",7))),
b=c(rep(NA,2),runif(7)));my.df
a group b
1 1 A NA
2 2 A NA
3 3 B 0.94365337
4 4 B 0.33983796
5 5 B 0.09819898
6 6 B 0.76511246
7 7 B 0.34347543
8 8 B 0.44897411
9 9 B 0.36672965
> mytable(group~.,data=my.df)
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
Many thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels