I believe the issue is in using three columns to create the correlation matrix. I attempted to follow the suggestions in this post: How can I create a correlation matrix in R? , but to no avail.
Furthermore, running the "rd_sample <- reading_data..." block gives the error "could not find function 'reading_data'". However, running "class(reading_data)" confirms it is a dataframe.
##corrplot
install.packages("corrplot")
rd_sample <- reading_data(live1 = rnorm(10), #live1 values are discrete
reg = rnorm(10), #reg values are discrete
books1 = rnorm(10)) #books1 values are continuous
M <- cor(rd_sample) # get correlations (returns matrix)
library(corrplot)
corrplot(M)
I would appreciate any suggestions.
Not being familiar with the function reading_data
, I simply created a data frame and then used your code with the defaults for corrplot
.
rd_sample <- data.frame(live1 = rnorm(10), #live1 values are discrete
reg = rnorm(10), #reg values are discrete
books1 = rnorm(10))
M <- cor(rd_sample) # get correlations (returns matrix)
library(corrplot)
corrplot(M)