R/PLANTS_download.R

Defines functions PLANTS_download_to_local_directory

PLANTS_download_to_local_directory<-function(directory){
    env<-new.env(parent=parent.frame())
    data(ref_PLANTS,envir=env)
    ref_PLANTS<-get("ref_PLANTS",envir=env)
    url<-"http://bricol.net/downloads/data/PLANTSdatabase/09-02-02PLANTSdata.csv"
    PLANTS<-read.table(url,fileEncoding="iso-8859-1")
    
    ## remove commas in species names since they conflict with TNRS

    PLANTS$Scientific.Name<-as.character(PLANTS$Scientific.Name)
    PLANTS$Scientific.Name<-gsub(","," ",PLANTS$Scientific.Name)
    PLANTS<-merge(ref_PLANTS,PLANTS,,by.x="Symbol",by.y="Symbol")
    save(file=file.path(directory,"PLANTS.Rda"),PLANTS)
    remove(list=c("ref_PLANTS"), envir = env)    

}

Try the TR8 package in your browser

Any scripts or data that you put into this service are public.

TR8 documentation built on Dec. 2, 2020, 1:06 a.m.