I want to create a sample matrix from the main one with the sam number of columns but less rows (50) I tried to use a series of loops but it didn't work:
n=nrow(data) camp <- sample(1:n,size=50,replace=TRUE) n<-length(camp) c<-ncol(data) for(i in 1:n){ t<-camp[i] for(k in 1:c){ campione[i,k]<-data[t,k]} }
data[camp,]