Domanda

I have some data table, imported from a text file.

Then I am using describe(table) function from psych package.

It returns variances, means and so on for each variable, including booleans, which are although marked with asterisk symbol.

age       1  5000  66.65  6.65   67.00   66.88  7.41  44.00  79.00  35.00  -0.33   -0.39   0.13
smokes*   2  5000  1.39   0.49   1.00    1.36   0.00  1.00   2.00   1.00    0.47   -1.78   0.01

How to exclude boolean variables from output of describe function?

È stato utile?

Soluzione

First, it is not a good idea to name an object table since this is the name of a very basic function in R.

It is not possible to exclude the statistics based on logical vectors from the object returned by describe, since both logical vectors and factors are indicated by an *. A solution is to exclude all logical columns from the object passed to describe.

For your data frame table:

describe(table[ , !sapply(table, is.logical)])
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top