Language R: How to get scientific numbers out of graphs?

Asked

Viewed 1,846 times

1

data frame taken from this command in the database:

mes = base_final %>%
group_by(mes)%>%
summarise(soma_trs = sum(valor_trs))

dataframe

mes <- data.frame(mes=c ("agosto/2017" , "setembro/2017", 
"outubro/2017") , soma_trs=c( 158491307 , 343986834 , 
922607132 ))

Plot

I used this command to make a bar graph

ggplot(mes,aes(x = mes, y = soma_trs))+
geom_bar(stat = "identity", fill = "blue") +
labs(title = '                             Valor Total de 
Transações')

the problem that in the graph, the values y are as scientific numbers, the values are high even due to the size of the base. How to improve base visualization?

also needed by transaction quantity, I used table in base

data frame.

qtd_trs <- data.frame (mes=c ("agosto/2017" , "setembro/2017", 
"outubro/2017") , qtd = c( 1157048 , 2327304 , 5966050)

Plot

barplot(table(qtd_trs$mes), col = "blue", main = "Número de 
Transações por Mês" )

The same problem happened. What is the best way to convert these values?

  • Could you offer a reproducible example of your dataset? https://answall.com/questions/264168/quais-as-principais-fun%C3%A7%C3%B5es-to-create-an-example-m%C3%Adnimo-reproduce%C3%Advel-em-r

1 answer

1


If your problem is just scientific notation, you can make this adjustment by options. Try this:

options(scipen = 999)

This high value (999) avoids the return of numbers in scientific notation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.