Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

R not identifying column headers as object- data read from xlsx

$
0
0

I'm learning to run linear regressions in r. I have a simple data set that I have read in with read.xl function. I get the column names fine but they aren't identified as objects so I can't do anything with them. My column headers are Cooper_score and VO2max.

library(readxl)
library(ggplot2)
Cooper <- read_xlsx("R_Learning/Cooper.xlsx", sheet=1)
View(Cooper)
colnames(Cooper)

This bit works fine but when I try any of the following i get an error

plot(Cooper_score,VO2max,xlab="Cooper Score", ylab="VO2(max)(ml/kg/min)")
cor(Cooper_score,VO2max)
simple_reg_cooper <- lm(VO2max ~ Cooper_score)
summary(simple_reg_cooper)

e.g.

Error in plot(Cooper_score, VO2max, xlab = "Cooper Score", ylab = "VO2(max)(ml/kg/min)") : object 'Cooper_score' not found

and the same for the correlation and linear regression functions


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>