I want to use ropls package in R to make PCA, PLS DA, OPLS DA plot, and get R2, Q2, VIP value. Anyone know how to use it? I have download introduction of ropls, but I want to get detail R script or step to use that package.
The linked pdf gives a good step by step guide of using ropls, and uses R syntax. I would recommend using RStudio and loading GGPlot2 for graphing, if you aren't already. GGplot2 is a package in CRAN so it has nice Vignettes and a good reference manual. It might be worth your time to look into other R packages in CRAN.
Getting the R2 is fairly simple, when you have your data load up Hmisc, set your data and run cor(x, y), but the Scores plot in ropls can give you R2 as well as other information (pg 6 & 7). Q2 and VIP can be found using other chemometric packages found in Cran, if they are not already in ropls. So you could use ropls to create the data and something like chemometics, chemometics with R, or chemoSpec to analyses and report the data. Srackoverflow is a good resource for questions in R.
and if you're just getting started I have included a link to youtube video form David Langer that goes through RStudio, installing packages and some tips and tricks in importing data. This might be too fundamental but it does have some good information.
I have a data with the same structure you indicated ("Make sure the first column has the sample names and the second has the group names") but I get error message when applied these codes.