[R] Console Output Formatting

Duncan Murdoch murdoch.duncan at gmail.com
Thu Sep 5 02:11:15 CEST 2013


On 13-09-04 5:56 PM, Noah Silverman wrote:
> Hi,
>
> Working with R, I often want to copy and paste some values somewhere else.  (Its not worth saving a CSV file for a dozen or so entries.)  Or, I may want to copy all the names of an object into some code.

Besides the other suggestions, the data editor in R can be a source for 
cut and paste to a spreadsheet, at least in Windows and Mac OSX.  This 
is useful for matrices and dataframes.

Duncan Murdoch


> R, rather nicely, wraps output with an index number on the left side.
>
> For example:
>
> [1] -1.07781972 -1.12157840  1.79303276  1.53313388 -1.30854455  0.45641730  0.23866722 -1.96265084
>    [9] -1.90779578 -0.68418936 -2.04910282  0.12008358 -1.71072687 -0.36707605 -0.36939204 -2.02799948
>   [17]  0.36466562 -1.34204214 -0.45100125 -0.60483154  0.42208268 -0.89535576 -1.09398009 -2.07257728
>   [25] -0.04615273 -0.23659570  0.27232736  1.28432538 -2.17042948 -0.45364579  1.52957528  0.39838320
>   [33]  0.64923323 -1.01651051 -0.36287974 -0.73787761  0.48088199 -1.19539814 -0.80079095 -1.02507331
>
>
>
> While this is great to read on screen, it is a pain to have to edit out all the index numbers.
>
> Is there a simple way to just back the values, or even a comma separated list of the values?
>
>
>
> Thanks!
>
>
>
> --
> Noah Silverman, M.S., C.Phil
> UCLA Department of Statistics
> 8117 Math Sciences Building
> Los Angeles, CA 90095
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list