rescale_bind: combine target and predictor data with rescaling

Description Usage Arguments Examples

View source: R/rescale_bind.R

Description

combine target and predictor data with rescaling

Usage

1
2
rescale_bind(data = NULL, date_col = c("Year", "Date"),
  scaling = c("Year", "Day"), aggMethod = c("mean", "max"))

Arguments

date_col

a two character element vector c("Date", "Date"), where the frist element is the date column from target. The second element is the date column from predictor, The string elements have to be any of names of lubridate accessor function with capitalizing the first letter, such as "Date", "Year", "Month", "Day", "Hour", "Minute", "Second", "Week", "Quarter", "Semester", "Am", "Pm", etc.

scaling

a two character element vector c("Date", "Date"), where the frist element is the destinate temporal scale for target, the second element is the destinate temporal scale for predictor The string elements have to be any of names of lubridate accessor function with capitalizing the first letter, such as "Date", "Year", "Month", "Day", "Hour", "Minute", "Second", "Week", "Quarter", "Semester", "Am", "Pm", etc

aggMethod

a two character element vector c("Date", "Date"), where the frist element is the aggregation method for target, the second element is the aggregation method for predictor. The string elements have to be those destinaGroup generic methods such as min, max, mean, etc.(see: ??dplyr::summarise)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(weather_tmin_sf)
data(corn_yield_sf)
corn_yield_st <- corn_yield_sf
weather_tmin_st <- weather_tmin_sf
target_data_t <- spatio_fuse(target_stN = corn_yield_st,
                               data_stN = weather_tmin_st,
                               parm_nm = "tmax",
                               crs = 2163); target_data_t
target_data <- target_data_t %>%
  nest(data = c(target, predictor)); target_data
data <- target_data[which(target_data$county == "boone"), ]$data[[1]]; data
# humboldt for none; allamakee for one; boone for two
rescale_bind(data,
          date_col = c("Year", "Date"),
          scaling = c("Year","Day"),
          aggMethod = c("mean","max"))

WeiquanLuo/stNet documentation built on Nov. 24, 2019, 5:11 p.m.