Commit f1e28951 authored by Daniel Falster's avatar Daniel Falster
Browse files

BCI data: refine slow species lookup loop

No related merge requests found
Showing with 2 additions and 5 deletions
+2 -5
......@@ -29,11 +29,8 @@ data.bci <- big.bci; rm(big.bci)
species.clean <- read.table("./data/raw/DataBCI/TaxonomyDataReport.txt",stringsAsFactors=FALSE, header = T, sep = "\t")
## Try to relate SpeciesID in species.clean species names in data.bci
data.bci$sp <- rep(NA,nrow(data.bci))
for(k in 1:nrow(species.clean)) {
latin.name <- apply(species.clean[k,2:3],1,paste,collapse=" ")[1]
data.bci$sp[which(data.bci$Latin == latin.name)] <- species.clean$SpeciesID[k] }
data.bci$sp2 = species.clean$SpeciesID[match(data.bci$Latin,
paste(species.clean[["Genus"]], species.clean[["species"]]))]
length(unique(data.bci$sp))
######################################
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment