I want to do the z-score by groups in R.
This is my code
data<-read.csv("C:/Users/usuario/Desktop/Tandas/TANDA JAPON/metabolomics/data/fwdreandres/R_PCA_tapR_sini.csv",sep=";",row.names = 1)
head(data)
#picture below is an example as variable names are too long

data<-scale(data,center = TRUE, scale = TRUE)
This code compute z-score for all the column, but not grouping by groups
Could you help me?
Many thanks,
Andrew