Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Copying comma separated values into Excel and R easily

This document will show how to copy the comma separated values from the graphic below into the software
packages Excel and R/RStudio. The easiest way to do this is via R/RStudio. Excel however, requires a little
bit of legwork in the interface. Suppose you are faced with the comma separated input below that you wish
to input into R/RStudio or Excel quickly.

Begin by highlighting the data as above (Note: do not include the square brackets []).Then copy the
highlighted values by either typing Ctrl C or right clicking and selecting Copy. Then use the instructions
below to input into Excel or R/RStudio respectively.

R/RStudio

To input the copied comma separated data into R. Use the create vector command c and paste. For
example, if you wanted to create a vector called x with the data. Write
> x = c(
in the command prompt as below

Then type Ctrl V or right click at the cursor and click Paste. The data should then fill the R prompt
and you just need to close the parenthesis by typing ) and pressing Enter

Excel

In your Excel spreadsheet, paste the values into a single cell. In the example below, it has been pasted into
the first cell, A1.

Then click on the cell, A1, and goto Data Text to Columns which launches a conversion wizard.
Then select Delimited and click Next.

Then on Step 2 of the wizard, select Comma and click Finish. You can skip the last step which sets
the format of the cells (currency or date etc.)

You might also like