I am new to R and am trying to run a regression analysis. I have constructed arbitrary vectors with the c() function to learn the plot, lm, fit, abline, and summary functions. That has worked properly, but when trying to regress imported data, I receive the following error message. I don't know what's causing the error or how to fix it. Any thought? Thanks.
library(xlsx)  
Loading required package: xlsxjars   
Loading required package: rJava    
x <- "~/Desktop/x.xlsx"    
y <- "~/Desktop/y.xlsx"   
X <- read.xlsx(x,1)  
Y <- read.xlsx(y,1)  
dim(X)  
[1] 149   1  
dim(Y)  
[1] 149   1  
plot(X,Y)  
Error in stripchart.default(x1, ...) : invalid plotting method  
plot(X)  
plot(Y)
Also, I don't think I understand all of the arguments accepted in the read.xlsx function. For example, if sheetindex is meant to index the sheets, wouldn't, in this example, x be 1 and y be 2? But then:
X <- read.xlsx(x,1)  
Y <- read.xlsx(y,2)   
Error in sheets[[sheetIndex]] : subscript out of bounds
Furthermore, the dimension is incorrect. The .xlsx file has 1 column, 150 rows, and no header.
dim(X)   
[1] 149   1
When converting to a .csv file, which I don't particularly want to do b/c of the total number of .xlsx file I have, I still have the same plotting error, however the dimension seems to be correct. In this example, the number of rows and columns remain the same at 1 and 150 respectively, but there is a header.
x <- "~/Desktop/x.csv"   
y <- "~/Desktop/y.csv"   
X <- read.table(x, header = T)    
Y <- read.table(y, header = T)    
plot(X,Y)    
Error in stripchart.default(x1, ...) : invalid plotting method    
dim(X)   
[1] 150   1   
 
     
     
    