Numeric variables read as characters

Apologies for what I'm sure is a basic question.

When I import my data set into rstudio using import from excel, I indicate that the first row should be variable names. In excel, I have all the necessary rows indicated as numeric. If I run str(data), it says that all the rows are numeric, as they should be.

However, if I try to run any amount of descriptive statistics on my variables, it gives me an error message saying that it is not numeric. Quite infuriating. Example below:

mean("Jul 2018 SMS score")
[1] NA
Warning message:
In mean.default("Jul 2018 SMS score") :
argument is not numeric or logical: returning NA

The funny thing is, if I run summary(data), it gives me all the standard descriptive statistics breakdown for the numeric variables. I'm really not sure where the breakdown here is., any help is appreciated.

It was a variable naming issue. Not a good morning for me. This is solved.

You are passing a character string to the mean() function (i. e. "Jul 2018 SMS score") instead of the name of a variable, if you share a reproducible example we can help you better

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.