简体   繁体   中英

Cocor package won't read my variable as numeric

I am performing correlations with the following data:

datacor
A tibble: 213 x 3
   Prop_coord Prop_assoc   PPT
        <dbl>      <dbl> <dbl>
 1      0.474      0.211    92
 2      0.343      0.343    85
 3      0.385      0.308    83
 4      0.714      0        92
 5      0.432      0.273    73
 6      0.481      0.148    92
 7      0.455      0.273    96
 8      0.605      0.184    88
 9      0.412      0.235    98
10      0.5        0.318    94
# … with 203 more rows

The cor.test works well, but when I try to compare correlations it shows this error:

> cocor(~ Prop_coord+PPT | Prop_assoc+PPT, datacor)
Error in cocor(~Prop_coord + PPT | Prop_assoc + PPT, datacor) : 
  The variable 'PPT' must be numeric

What should I do?

Just to keep the record here that someone elsewhere helped me with this, the problem was that cocor seems not to work with tibbles. So when I read my data with data.frame, it worked perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM