Reputation: 4648
I learnt that there are two ways to nicely format R code in RStudio. One listed under Code -> Reformat code
. The other is @yihui (formatR:tidy_r source code)
which in current Version 0.99.893 of Rstudio, can be added as an addin. I noticed that, the in-built Reformat code
formats the code to new line every time it encounters a comma ,
( Imagine if you have a list of 10 parameters for some function, you will have 10 lines). However, I personally like @yihui tidy_r
. So my questions are
1) How to make formatR as a default in Rstudio ?
2) Has anyone noticed errors while using formatR when run on Rshiny apps ? When I run this as an Addin on my shiny code, I get the error below...
Warning: Error in base::parse: <text>:81:1: unexpected symbol
80: invisible(".BeGiN_TiDy_IdEnTiFiEr_HaHaHa.HaHaHa_EnD_TiDy_IdEnTiFiEr")
81: invisible
@yihui on his github page mentioned in 2012 that formatR is still not good at dealing with #. is this the case still ?
update as per comment
query = c(
"26527521","26711930","26314551","26720421","26715198","26714964"
)
When the above input is formatted using Code -> Reformat code
, results the output below
query = c("26527521",
"26711930",
"26314551",
"26720421",
"26715198",
"26714964")
Upvotes: 0
Views: 1188