Pasting into an Excel Spreadsheet
Writing a vector from R to the Windows clipboard uses the function writeClipboard(x) where x is a character vector, so you need to build up a spreadsheet in Excel one column at a time. Remember that character strings in dataframes are converted to factors on input unless you protect them by as.is(name) on input. For example
writeClipboard(as.character(factor.name))
Go into Excel and press Ctrl+V, and then back into R and type
writeClipboard(as.character(numeric.variable))
Then go into Excel and Ctrl+V in the second column, and so on.
Get The R Book now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.