I'm looking to incorporate information from different sized vectors into a matrix. I'd like to list values as either row or column names, and if present in any one of these vectors, will be set to 1. If absent in any one of these vectors, will be set to 0. I can have upwards of 20 vectors, containing a string of upwards of 300 values Apologies if my terminology is incorrect, I'm relatively new to R!

An example of my data:

v1 = "ASV581" "ASV547" "ASV434" "ASV378" "ASV7" "ASV1478" "ASV676" "ASV361" "ASV142" "ASV92" "ASV16" "ASV2"

v2 = "ASV15" "ASV7" "ASV5" "ASV2" "ASV676" "ASV581" "ASV522" "ASV361"

v3 = "ASV1" "ASV7" "ASV3" "ASV15 "ASV2" "ASV38" "ASV28 "ASV22" "ASV5" "ASV346""ASV208" "ASV139" "ASV13" "ASV919" "ASV676"

v4 = "ASV15" "ASV7" "ASV5" "ASV2" "ASV208" "ASV139" "ASV361" "ASV142"

So far I've combined all vectors and generated a unique list:

`x <- c(v1, v2, v3, v4)`

`ASVitems <- unique(x)`

But I seem to be having problems generating the matrix and get setting conditions for presence or absence.

Here is an example of what I would like to have, where ASVs are row names:

[v1] [v2] [v3] [v4] ...

ASV2 1 1 1 1

ASV3 0 0 1 0

ASV5 0 1 1 0

ASV7 1 1 1 1

...

Thanks!

A