get_agricurb_data: Function to obtain the real agricultural data in a convenient...

Description Usage Arguments Value Examples

View source: R/get_agricurb_data.R

Description

1
2
3
The function \code{get_agricurb_data} pre-process the agricultural data into a convenient format ready to analisis.

The formatting process is as follows:
  1. Keep modern data and as many archaeological datasets as specified in arc_datasets.

  2. Eliminate rows with unknown Size in the archaeological datasets.

  3. Eliminate rows with Category different to wheat and barley.

  4. Modify Rainfall in the archaeological data sets. Creates Rainfall_min=Rainfall+minRainfall and Rainfall_max=Rainfall+maxRainfall, and after that Rainfall=NA.

  5. Transform the variables listed in vars_log to a logaritmic scale.

  6. Rescale the variables listed in vars_scale_int_0_1 to the interval [0,1].

  7. Rescale the variables listed in vars_scale_mean_0_var_1 to have empirical mean 0 and empirical variance 1.

Usage

1
2
3
4
5
6
7
get_agricurb_data(
  arc_datasets = "NMeso",
  vars_log = NULL,
  vars_sqrt = NULL,
  vars_scale_int_0_1 = NULL,
  vars_scale_mean_0_var_1 = NULL
)

Arguments

arc_datasets

indicated the datasets used for sampling the archaeological covariates.

vars_log

indicated the variables to be rescale to have mean 0 and variance 1.

vars_sqrt

indicated the variables that are transformed with square root.

vars_scale_int_0_1

indicated the variables to be rescale to the interval [0,1].

vars_scale_mean_0_var_1

indicated the variables to be rescale to have mean 0 and variance 1.

Value

Returns a data frame similar to AgricurbAll ready to analyse with the current methods, such as mcmc_PO1_HM1_HM1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
require(ggplot2)

Agricurb_data <- get_agricurb_data( arc_datasets = "NMeso",
                                         vars_log = c("Rainfall"),
                                         vars_scale_int_0_1 = c("Size", "Rainfall"),
                                         vars_scale_mean_0_var_1 = NULL )
Agricurb_data$ManureLevel <- factor(Agricurb_data$ManureLevel,levels=c("low","medium","high"))

# archaeological data identifier
id_arch <- !is.element(Agricurb_data$dataset,"modern")

#####
# Checking data characteristics
#####

# HM model #
# Relation between Rainfall and normd15N
# (assuming missing data)
p <- ggplot( aes(x=Rainfall,y=normd15N), data=Agricurb_data)
p <- p + geom_point(aes(colour=ManureLevel), pch=20, size=3, alpha=0.7)
p

christianu7/aistats2020smi documentation built on March 7, 2021, 2:40 p.m.