2

I'm trying to find the least square mean of "post" by "group". Values of "group" are "TEST" or "CONTROL".

mixed_data <- data.frame(group, pre, post)
mixed_lm <- lm(post ~ group + pre, data=mixed_data)
mixed_lsmean <- lsmeans(mixed_lm, "group")

But I received this error and don't understand why:

Error in format.default(nm[j], width = nchar(m[1, j]), just = "left") :
4 arguments passed to .Internal(nchar) which requires 3

Any idea?

989
  • 12,579
  • 5
  • 31
  • 53
Bing Cui
  • 45
  • 3
  • I've tried to reinstall the lsmeans package and the code works perfectly. But one day after that it fails again and the same error occurs. It's driving me crazy. – Bing Cui Jul 29 '15 at 13:52
  • Maybe it's some other package. Have you done a general update.packages()? – Russ Lenth Jul 29 '15 at 19:06

1 Answers1

1

I experienced this issue myself just now on a new laptop. I initially installed R 3.2.0 on it, as I had the binary on a thumb drive. Then, after installing lsmeans, I observed the same error when running example(lsmeans). But then I installed R 3.2.1, and everything worked fine. So, my guess is that you have R 3.2.0 or earlier.

Russ Lenth
  • 5,922
  • 2
  • 13
  • 21