[R] output my results into Excel

Dalthorp, Daniel ddalthorp at usgs.gov
Wed Mar 2 21:50:45 CET 2016


Hi Michael,
If you are working in Windows:

# You can put the matrix directly into the clipboard
write.table(PRdist, file = 'clipboard', sep = '\t', row.names = F,
col.names = F)

The "sep" argument tells what character to use for separating columns.
Default for Excel is tab (i.e. '\t')

Default for write.table on a matrix or 2-d array is to write column names
(as "V1", "V2", etc.) and row names ("1", "2", etc.). If you don't want
those added to your matrix, tell R via row.names = FALSE, col.names = FALSE



-Dan

On Wed, Mar 2, 2016 at 12:31 PM, Michael <elopomorph at hotmail.com> wrote:

> I can get R to calculate the distance that I want between my data points.
> However, I am stuck trying to get R to output the data so I can paste it
> into Excel.  Instead, R outputs a matrix mess in the console.
>
> Below are the steps I am taking to calculate the distance between my
> data.  Also, I have 42 different data points.
>
> # Calculate the Euclidean distance between each datapoint using
> # the function dist()
>
> PRdist = dist(my_data) ;  PRdist
>
> I would greatly appreciate if someone can tell me how to output my matrix
> from the dist function into something I can paste into Excel.
>
> Mike
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



-- 
Dan Dalthorp, PhD
USGS Forest and Rangeland Ecosystem Science Center
Forest Sciences Lab, Rm 189
3200 SW Jefferson Way
Corvallis, OR 97331
ph: 541-750-0953
ddalthorp at usgs.gov

	[[alternative HTML version deleted]]



More information about the R-help mailing list