join_by_id: Join variables with coordinates to the destination file by...

Description Usage Arguments Value Examples

View source: R/join_by_id.R

Description

Join variables with coordinates to the destination file by ID, so it requires an ID file with coordinates

Usage

1
2
3
4
5
6
7
join_by_id(
  IDfile,
  coordinatefile,
  file2merge = merged,
  varname = "value",
  newname
)

Arguments

IDfile

sp or dataframe with coordinate and ID that Oliver uses

coordinatefile

sp or datafrme with coordinate and variables values (air quality measurements) but no ID

file2merge

dataframe to merge to, i.e. file with all the variables

varname

the name of the variable in the coordinatefile to merge

Value

a dataframe

Examples

1
2
3
4
5
6
7
join_by_id(IDfile= testoaq, coordinatefile=meanoaq, file2merge = merged, varname='day_mean')
require(sf)
require(maptools)
require(sp)
meanoaq = read.csv('q_day.csv') #locations and values
testoaq = read.csv('openaqmorethan1000_ch_locations.csv') # ID with locaitons
join_by_id(IDfile= testoaq, coordinatefile=d, file2merge = merged, varname='value', newname = 'day_value')

mengluchu/APMtools documentation built on Jan. 27, 2022, 2:41 a.m.