Description Usage Arguments Value Examples
View source: R/CorrelationIndex.R
Works very similarly to vlookup in excel. The output is a field in the dataset you are wanting to copy information into. The syntax is something like: MyDataframe$CopiedField = lookup(MyDataframe$joinField, OtherDataframe$joinField, OutherDataframe$DataToCopy)
1 | lookup(MasterDataField, AdditionField, AdditionInputField)
|
MasterDataField |
vector - a field with common values to those in another dataset you want to lookup data in. |
AdditionField |
vector - a field with common values to MasterDataField |
AdditonInputField |
vector - the data you are importing to the Master dataframe where the AdditionField matches the MasterDataField |
vector - will reurn the vector corrosponding to the MasterDataField that are found in the lookup field AdditonInputField
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #Lookup DF
HabID = c(1, 2, 3, 4, 5, 6)
Habitat = c("BLeave", "AGrass", "CGrass", "Water", "Bog", "Heath")
Desc = c("Broadleaved and mixed woodland", "Acid grassland","Calcareous grassland", "Inland freshwater", "Sphagnum bog", "Caluna heathland")
OpenClosed = c("Closed", "Open", "Open", "Open","Open","Open")
DomSpecies = c("Oak", "Bent grass", "Festuca ovina", "NA", "Sphagnum Spp.", "Caluna Spp.")
lookupdf = data.frame(HabID, Habitat, Desc, OpenClosed, DomSpecies)
#Feild sites dataframe.
SiteID = c(1,2,3,4,5,6,7,8,9,10)
SiteHabitat = c("BLeave", "AGrass", "BLeave", "AGrass", "Heath", "Bog", "Water", "BLeave", "Water", "Heath")
SitesDF = data.frame(SiteID, SiteHabitat)
#Looking up the descriptions of the habitats.
SitesDF$HabDesc = lookup(SitesDF$SiteHabitat, lookupdf$Habitat, lookupdf$Desc)
#You could lookup other information from the lookup table.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.