Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Spearman-Brown coefficient code producing N/A

How to make this Spearman-Brown coefficient code work? It gives me an output NA

spearman_brown(df[,1], df[,2], short_icc, type = "ICC1", lmer = FALSE)

Data

structure(list(var1 = c("5", "2", "5", "2", "3", "1", "6", "1", 
"4", "5", "5", "2", "2", "3", "1", "3", NA, "5", "7", "5", "2", 
"2", "2", NA, "2", "3", "2", "2", "5", "2", "4", "2", "3", "5", 
"5", "5", "5", "2", "4", NA, "6", "7", "7", "3", "2", "3", "3", 
NA), var2 = c("2", "1", "2", "2", "2", "1", "1", "1", "2", "2", 
"3", "1", "2", "2", "1", "2", NA, "3", "2", "1", "2", "2", "1", 
NA, "1", "2", "1", "1", "2", "1", "1", "2", "2", "2", "4", "3", 
"2", "2", "1", NA, "2", "2", "4", "1", "2", "3", "2", NA)), row.names = c(NA, 
-48L), class = c("tbl_df", "tbl", "data.frame"))

I tried to do it as in the example on this page https://search.r-project.org/CRAN/refmans/splithalfr/html/spearman_brown.html

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It is a tibble, so we need to extract with [[ (or $) instead of [, as [ wouldn’t drop the dimensions for tibble or data.table i.e. df[,1] or df[,2] will still be a tibble with a single column where as spearman_brown x and y should be vectors

spearman_brown(df[[1]], df[[2]], short_icc, type = "ICC1", lmer = FALSE)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading