Collective Action
Collective Action

Reputation: 7999

How do I copy code from the console to the editor/source pane in Rstudio

User interface = Rstudio. Is there a short-cut key that will paste code from my console in Rstudio to a R Markdown file that I am developing in the workspace above the console?enter image description here

In the picture above, I would like to move the read1_file <- read.table("C:/Users/perdue/Desktop/Adv. MicroEconometrics/HA 3/data/read1.sas", header= FALSE, skip = 1, sep = ",", dec=".") code from the console into the R2b_Michael.Rmdfile using a short-cut key.

Upvotes: 3

Views: 5191

Answers (1)

dww
dww

Reputation: 31452

You can easily copy lines of code from the history pane in Rstudio to either the console or to the editor.

  1. First show the history pane. In the default layout it is a tab next to the environment tab in the top right pane.

  2. Then highlight the commands you want to copy. You can click on a single command. Or shift-click selects a range or ctrl-click selects multiple commands.

  3. Then shift-Enter copies the selected commands to the editor.

  4. Alternatively, just pressing Enter copies the commands to the console

Upvotes: 4

Related Questions