I'm learning R and have a tibble with some World Bank data. I used the apply() function in a slice of the columns and applied the standard deviation over the values, in this way: result <- apply(df[6:46],2,sd,na.rm=TRUE)
.
The result is an object with two columns with no header, one column is all the names of the tibble columns that were selected and the other one is the standard deviation for each column. When I use the typeof() command in the output, the result is 'double'
. The R documentation says the output of apply() is a vector, an array or a list.
I need to know this because I want to extract all the row names and using the command rownames(result)
throws the output NULL
. What can I do to extract the row names of this object?
Tried rownames(result)
and row.names(result
and none worked.