Invoking column name with five words

I am trying to calculate mean of a column call Speed of answer in seconds but because of white spaces it's giving error.
How should one write the column name that contains white space
mean[mydata$Speed of answer in seconds]

use backticks

mean[mydata$`Speed of answer in seconds`]

Or, if you don't want to use backticks, you can use [[. Such as
mean(mydata[['Speed of answer in seconds']]). Doing this is much less common than using $, but can be useful if you need to loop over column names.

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.