This is the original matrix if it helps. I am trying to do part A.
I am completely new to R, like 6 days new. Our instructor just gave us these questions with almost no R explanation. Is there a way to fill the matrix in the image in a more of an qutomatic way, rather than doing everything one by one. So far all I did is:
x_and_y_val <- matrix(c(3,4,2,2,1,3,-1,1,0, 0),ncol=2,byrow=TRUE)
colnames(x_and_y_val) <- c("x","y")
rownames(x_and_y_val) <- c("","", "", "", "")
x_and_y_val <- as.table(x_and_y_val)
# original matrix with x and y
x_and_y_val
#find the averages of Xs and Ys
x_avg <-
y_avg <-
I will then find their averages complute all the values and eventaully create a new matrix of size 5x6. But I have a very strong feeling that there can be a better more efficient way. If you know how, can you explain it to me. Or direct me to a source that does?
Stay safe and Healthy!