Graphic by ggplot in RStudio v 1.1.463 does not read subtitle and caption in labs ()

0

I have the problem reported in the title and I do not understand why in RStudio subtitle and caption are not read. When I replicate the code in Visual Studio, it loads all the commands correctly - the graphic looks exactly like it is in the code.

Here is the code and a snippet of data to replicate in RStudio:

ggplot(Endividamento_Familias_Mensal, aes(Data, 
Endividamento_Familias)) +
  geom_line() +
  labs(title = "Endividamento Familiar", caption = "Fonte: PNADC - 
Bacen")

The data is:

Thissamecode,withthesamedata,executedbyVisualStudio,generatesthechartcorrectly.

SeehowitlooksinRStudio:

    
asked by anonymous 30.12.2018 / 18:42

1 answer

2

The caption argument has been inserted into the version 2.2 , which is November 2016 ( source ).

According to some comments, this is not an error in RStudio. Most likely, without knowing sessionInfo() , is that the version of R used by the Visual Studio shell and in RStudio are different and that in the latter the available ggplot2 is less than 2.2.

You can check the version of tag being used in RStudio with the beginning R.version[["version.string"]] . You can change the version used in RStudio in the Tools > Global Options... . On the General tab, choose the version of R you want.

To check the version of ggplot2 being used, just run installed.packages()["ggplot2", "Version"] . Make sure the number is greater than "2.2".

    
02.01.2019 / 04:19