Home > OS >  Convert multiple lines to single line using RStudio text editor
Convert multiple lines to single line using RStudio text editor

Time:03-14

Does the RStudio text editor have a simple automated way to convert this:

c(
"097",
"085",
"041",
"055"
)

to this: c("097", "085", "041", "055")?

There are answers for other text editors (e.g., enter image description here

CodePudding user response:

As mentioned by @rdelrossi, datapasta is a helpful package for editing and styling text/code. On Mac, once you install the package (also installs as an add-in), then you have access to several keyboard shortcuts. For example, to convert a vector from vertical to horizontal, you could use vector_paste() or use the keyboard shortcut, which is ctrl alt shift v.

enter image description here

You can read about some of the other functions and shortcuts (e.g., paste as vertical vector) at Typical Datapasta Usage with Rstudio.

  • Related