Csaba Szabo - 9 months ago 41

R Question

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 ...

Answer Source

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 ...