-2

This might be a very lame question, but I cannot really figure out what's going. Normally if I called this function:

summary(VLTcog$per ~ VLTcog$Cognate)

The output that I got was:

VLTcog$per N=90

+--------------+--+--+----------+
| | |N |VLTcog$per|
+--------------+--+--+----------+
|VLTcog$Cognate|C |48|74.42708 |
| |NC|42|56.42857 |
+--------------+--+--+----------+
|Overall | |90|66.02778 |
+--------------+--+--+----------+

Now, if I do the same, the only output it gives me is:
Length Class Mode
3 formula call
str of my data
str(VLTcog)
'data.frame': 90 obs. of 4 variables:
$ Item : Factor w/ 90 levels "1 acquiesce",..: 86 16 30 62 28 53 26 83 51 65 ...
$ Cognate : Factor w/ 2 levels "C","NC": 1 1 1 1 2 1 2 2 1 2 ...
$ Frequency: Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
$ per : num 100 67.5 95 82.5 87.5 67.5 95 40 87.5 87.5 ...

Csaba Szabo
  • 103
  • 1
  • 2
  • 10
  • Basically, if I called that summary function, I used to get a nice chart where means, counts were displayed by grouping variable and the total... Now, I only get this output Length Class Mode 3 formula call and nothing else... – Csaba Szabo Nov 13 '16 at 15:43
  • This is the problem, I always use the same libraries and I loaded them all, restarted Rstudio, updated Rstudio and still nothing... – Csaba Szabo Nov 13 '16 at 15:46
  • You must have had a `summary()` function loaded from some package or source file before. It will be basically impossible (or take some *very* lucky guessing) to figure out where it came from and why you don't have it any more. – Ben Bolker Nov 13 '16 at 16:06
  • @Ben, thanks a lot for replying. The problem is that I have a list of packages that I always use and load. The latest one was TAM, when it was still working... then I installed ltm... however I cannot really link the two problems together... No new packages should change how a function works, which is part of the basic package... – Csaba Szabo Nov 13 '16 at 16:13

1 Answers1

3

It looks like your summary behaviour was coming from Hmisc::summary.formula (I used library(sos); findFn("summary.formula") to figure this out ...)

In a clean R session:

x <- 1:10
y <- 1:10
summary(y~x)
## Length   Class    Mode 
##   3 formula    call 

Now load Hmisc:

library(Hmisc)
packageVersion("Hmisc")
## [1] ‘4.0.0’
summary(y~x)
## y     N= 10 
## 
## +-------+------+--+---+
## |       |      |N |y  |
## +-------+------+--+---+
## |x      |[1, 4)| 3|2.0|
## |       |[4, 6)| 2|4.5|
## |       |[6, 9)| 3|7.0|
## |       |[9,10]| 2|9.5|
## +-------+------+--+---+
## |Overall|      |10|5.5|
## +-------+------+--+---+

So I suggest you see how things go if you try this in a session with only Hmisc loaded, then try out other packages to see if one of them masks the summary.formula method ...

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453