I am trying to use rmcorr R package for data analysis of repeated samples.
I want to make it go through all pairs of columns and estimate their correlation. The problem is rmcorr accepts only unquoted column names as arguments:
>> rmcorr(Subject, PacO2, pH, bland1995)
So, an expression like rmcorr(colnames(bland1995)[1], colnames(bland1995)[2], colnames(bland1995)[3], bland1995) throws an error:
Error in rmcorr(colnames(bland1995)[1], colnames(bland1995)[2], colnames(bland1995)[3], :
'Measure 1' and 'Measure 2' must be numeric
So I hoped do.call would help me. Haha, fat cha
>> do.call('rmcorr', args = list(colnames(bland1995)[1], colnames(bland1995)[2], colnames(bland1995)[3], bland1995))
Error in rmcorr("Subject", "pH", "PacO2", list(Subject = c(1L, 1L, 1L, :
'Measure 1' and 'Measure 2' must be numeric
In addition: Warning message:
In rmcorr("Subject", "pH", "PacO2", list(Subject = c(1L, 1L, 1L, :
'Subject' coerced into a factor
How do I pass string variables to such a kind of function?