My little example is as follows:
x = c(5,1,3)
y = c(-1,3,1)
X = cbind(x,y)
I want to achieve
x1 = X[1,]
y1 = X[2,]
z1 = X[3,]
in a loop. Then I try
x = c(5,1,3)
y = c(-1,3,1)
X = cbind(x,y)
nr = nrow(X)
nc = ncol(X)
for(i in nr){
k = length(letters)
get(paste0(letters[k-(nr-i)],1)) = X[i,]
}
But I get a error as
Error in get(paste0(letters[k - (nr - i)], 1)) <- X[i, ] :
could not find function "get<-"
How can fix this issue?