Hi team,
I am trying to run PlotIndiv on my PCA, CCA and PLS data. However, I see the following error message.
Error in $<-.data.frame
(*tmp*
, “pch.legend”, value = c(NA, NA, 2L, :
replacement has 1155 rows, data has 200
In addition: Warning message:
In shape.input.plotIndiv(object = object, n = n, blocks = blocks, :
‘ind.names’ is set to FALSE as ‘pch’ overrides it
And the code I have run is
plotIndiv(otus.pca, group= metadata_arcli$BMI,
title = ‘OTUs, PCA, comp 1 - 2’, legend=TRUE,
legend.title = ‘BMI’,
pch = as.factor(metadata_arcli$Sex),
legend.title.pch = ‘Sex’)
Could you please help me resolve this.
Thank you so much.
Regards,
Mrudhula
Hi @Mrudhula,
Try the following and let me know if your problem is resolved:
plotIndiv(otus.pca, group= metadata_arcli$BMI,
title = ‘OTUs, PCA, comp 1 - 2’, legend=TRUE,
legend.title = ‘BMI’,
pch = as.numeric(factor(metadata_arcli$Sex)),
legend.title.pch = ‘Sex’)
Please read plotIndiv
documentation for pch
for more info.
Thank you for your response @aljabadi.
I tried the code and I got the error again.
Error in $<-.data.frame
(*tmp*
, “pch.legend”, value = c(NA, NA, NA, :
replacement has 1155 rows, data has 200
In addition: Warning message:
In shape.input.plotIndiv(object = object, n = n, blocks = blocks, :
‘ind.names’ is set to FALSE as ‘pch’ overrides it
Hi @Mrudhula,
Do you have missing values in metadata_arcli$BMI
? If that is the case ensure you replace them by a valid informative factor representing missing values. As a side note, ensure that the group
argument (metadata_arcli$BMI
here) is categorical and not continuous. That is, if you want to group by Body Mass Index, it is only possible if you bin BMI values first (e.g. BMI < 18, 18 =< BMI =< 25 etc).
Thank you for the respone.