dataDiagnostics.Rd
This function provides visualisations of how the number of records in the dataset changes over time and how the number of species recorded on a visit changes over time. For each of these an linear model is run to test if there is a significant trend.
dataDiagnostics(taxa, site, time_period, plot = TRUE, progress_bar = TRUE)
taxa | A character vector of taxon names, as long as the number of observations. |
---|---|
site | A character vector of site names, as long as the number of observations. |
time_period | A numeric vector of user defined time periods, or a date vector, as long as the number of observations. |
plot | Logical, if |
progress_bar | If |
A list of filepaths, one for each species run, giving the location of the output saved as a .rdata file, containing an object called 'out'
# NOT RUN { ### Diagnostics functions ### # Create data n <- 2000 # size of dataset nyr <- 20 # number of years in data nSamples <- 200 # set number of dates useDates <- TRUE # Create somes dates first <- as.POSIXct(strptime("2003/01/01", "%Y/%m/%d")) last <- as.POSIXct(strptime(paste(2003+(nyr-1),"/12/31", sep=''), "%Y/%m/%d")) dt <- last-first rDates <- first + (runif(nSamples)*dt) # taxa are set as random letters taxa <- sample(letters, size = n, TRUE) # three sites are visited randomly site <- sample(c('one', 'two', 'three'), size = n, TRUE) # the date of visit is selected at random from those created earlier if(useDates){ time_period <- sample(rDates, size = n, TRUE) } else { time_period <- sample(1:nSamples, size = n, TRUE) } # Using a date dataDiagnostics(taxa, site, time_period) # Using a numeric dataDiagnostics(taxa, site, as.numeric(format(time_period, '%Y'))) # }