1
I need to generate the average in a column of value of a table in R, but I’m not getting it. I’ve done so creating a vector:
x <- c(15,12,8,9,5,6,1,2)
mean(x)
It works, but when I point to the table I generated inside the R I cannot:
x <- (receitas_vs_depesas_contratadas_tidy %>%
select.list(VR_TOTAL_RECEITA))%>%
mean(x)
erro:Error in (receitas_vs_depesas_contratadas_tidy %>% select.list(VR_TOTAL_RECEITA)) %>% :
could not find function "%>%"
Load the package
dplyr
ortidyverse
to gain access to the command%>%
. After that, the command(receitas_vs_depesas_contratadas_tidy %>% select.list(VR_TOTAL_RECEITA))%>%
will continue to give error. Please, take a look at this link and here’s how to ask a playable question in R. Edit your question with the necessary details so we can help you in the best way possible.– Marcus Nunes
imported the package and changed the code:
– Danilo
media<-c(receitas_vs_depesas_contratadas_tidy %>% select(VR_TOTAL_DESPESA)%>% mutate(media=Mean(VR_TOTAL_DESPESA)))
– Danilo
but has not yet resolved
– Danilo
That’s why I posted the link above. If we don’t have a piece of your data set, we’re gonna sit here groping in the dark and not come to any conclusions. Edit your question to make it playable. It will be more laborious at first, but everyone here will save you time, including yourself.
– Marcus Nunes
If you just want the column average with the package
dplyr
nor is it necessary toselect
. See this example with the datasetiris
that comes with the base R.iris %>% summarise(media = mean(Sepal.Length))
. Note that it issummarise
, is notmutate
.– Rui Barradas