mergewithorder: Merge with Order

Description Usage Arguments Value See Also Examples

View source: R/mergewithorder.R

Description

This function merges two dataset without changing the order of the base dataset.

Usage

1
mergewithorder(df1, df2, by = NULL)

Arguments

df1

a data frame object, the order of which needs to be unchanged.

df2

a data frame object be joined with df1

by

unique identifiers used to join df1 and df2, same as by in merge

Value

a joined data frame with the same order as df1

See Also

merge

Examples

1
2
3
4
5
data(mobility)
mobility$distgroup<- groupdist(mobility, coor = c("lon", "lat"), threshold = 100, groupvar = "id")
latmean<- aggregate(lat~distgroup, mobility, mean)
names(latmean)<- c("distgroup","latmean")
mobility<- mergewithorder(mobility, latmean, by = "distgroup")

nyu-mhealth/Mobility documentation built on Feb. 24, 2020, 10:37 p.m.