R/createDataframe.R

Defines functions createDataframe

# this script returns a dataframe with columns "ID" and "YEAR"
# where each values of uI is matched to each year

createDataframe <- function(uI, years){
  
  DF <- NULL
  for(j in 1:length(uI)){
    ID.j <- rep(uI[j], times = length(years))
    DF.j <- data.frame(ID.j, years)
    DF <- rbind(DF, DF.j)
  }
  names(DF) <- c("ID", "YEAR")
  DF
}

Try the marindicators package in your browser

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

marindicators documentation built on Nov. 12, 2019, 5:07 p.m.