Dear all,
I have a simple question regarding a problem I can't solve.
Can you recommend a way, package or code with which I can solve the following problem:
X and Y correlate 0.5. Is there a way that I save the 0.5 correlation coefficient value as a new variable? The 0.5 correlation coefficient should be the same for all respondents.
Thanks to everyone who will try to help me with this in advance!
Kind regards, L
newVariable <- cor(y,x)
There seems to be an issue with that.
"object not found" no matter what dataset I use, all are scale variables in the normal social sciences data format (rows are respondents, collums numeric variables)
x <- c(1,2,3,4,5,6,7,8,9,10) y <- c(1,2,3,4,5,10,9,8,7,6) z <- cor(x,y) class(z)
[1] "numeric"
w <- rep(z, length(x)) df <- data.frame(cbind(x,y,w)) df
Thank you for your useful advice!
Hello,
I would highly recommend the corrr package for this.
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.