Hi, I'm trying to calculate correlation coefficients and p values for a dataset using rcorr. I got an error which I think means it doesn't like that some of the variables are stored as double:
fisherDataCor2<-rcorr(as.matrix(fisherData, ))
head(fisherDataCor2)
Warning in storage.mode(x) <- "double" : NAs introduced by coercion
Error in rcorr(as.matrix(fisherData)) :
NA/NaN/Inf in foreign function call (arg 1)
I then went back to convert the relevant variables to numeric and repeatedly failed. I tried using =numeric and got the invalid length argument error:
fisherData<- fisherData %>% mutate(MSL_PC1_16=numeric(MSL_PC1_16))
Show in New Window
Error: Problem with mutate()
column MSL_PC1_16
.
MSL_PC1_16 = numeric(MSL_PC1_16)
.
x invalid 'length' argument
I then tried using as.numeric, and the code ran fine, but when I checked the data type was still double. I then tried several variations of that as suggested by other posts here, all of which "ran" without actually changing the data type.
fisherData%>%mutate(MSL_RC1_16=as.numeric(MSL_RC1_16))
fisherData$MSL_PC1_16<-as.numeric(fisherData$MSL_PC1_16)
fisherData[,'MSL_PC1_16]<-as.numeric(fisherData[,'MSL_PC1_16'])
Any further suggestions for what I can try would be much appreciated!