[R] how to combine presence only data sets to one presence/absence table

Patrick Zimmermann brassnotdead at googlemail.com
Wed Jul 18 12:30:14 CEST 2007


Problem: I have a Set of samples each with a list of observed species
(presence only).
Data is stored in a excel spreadsheet and the columns (spl) have
different numbers of observations (spcs).
Now I want to organize the data in a species by sample matrix with
presence/absence style in R.

data style (in excel):

spl_A	spl_B	spl_C
spcs1	spcs1	spcs2
spcs2	spcs3	spcs3
spcs4		spcs5
spcs5

desired style:

	spl_A	spl_B	spl_C
spcs1	1	1	0
spcs2	1	0	1
spcs3	0	1	1
.
.
.

How and in which form do I import the data to R?
(read.table() seems not to be appropriate, as data is not organized as a table)

How can I create the species by sample matrix?

Thanks for any help,
Patrick Zimmermann



More information about the R-help mailing list