mergewithorder: Merge with Order

View source: R/mergewithorder.R

mergewithorderR Documentation

Merge with Order

Description

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

Usage

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

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 July 4, 2025, 9:54 a.m.