3

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.

dww
  • 30,425
  • 5
  • 68
  • 111
Collective Action
  • 7,607
  • 15
  • 45
  • 60
  • @dww Yes :-), I am indeed. – Collective Action Nov 15 '17 at 17:34
  • could you explain a little more in the question what it is tht you need, whch ctrl-c does not do? – dww Nov 15 '17 at 17:35
  • Here's a rough sequence of the unsophisticated variety: `C-1 --> (up arrow to command) --> C-a --> C-c --> C-2 --> C-v`. – lmo Nov 15 '17 at 17:35
  • @dww One problem with ctrl +c -> ctrl + v is that it copies the `>` characters when copying multiple commands. Then I have to go back and delete all of them. – Collective Action Nov 15 '17 at 17:39
  • 2
    if you show the history pane, then you can highlight the commands you want and shift-enter copies them to the code pane (or just enter copies them to the console). PS if this solves your issue, I'll turn the comment into an answer – dww Nov 15 '17 at 17:42
  • @dww Vielen Vielen Vielen Dank! It solved my issue!!! – Collective Action Nov 15 '17 at 17:48

1 Answers1

4

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

dww
  • 30,425
  • 5
  • 68
  • 111