expand_column_values: expand_column_values

View source: R/distance.r

expand_column_valuesR Documentation

expand_column_values

Description

Creates extra columns to store in a list

Usage

expand_column_values(column, values, index_i, index_j)

Arguments

column

Name of column to be expanded

values

Actual vector of data to expand

index_i

vector of indexes to expand column

index_j

Second vector of indexes to expand column

Details

Given a vector of values, create repeated values of it according to two index variables.

Value

A list

Examples


thedf <- data.frame(
ID=rep(LETTERS[1:3], length.out=10),
x=sample(10),
y=sample(10),
extra1=sample(letters, size=10),
extra2=sample(letters, size=10),
extra3=sample(10),
extra4=Sys.time() + 1:10
)
distancethreshold:::expand_column_values('extra1', thedf$extra1, index_i=c(1, 3), index_j=c(2, 4))
distancethreshold:::expand_column_values('extra2', thedf$extra2, index_i=c(1, 3), index_j=c(2, 4))
distancethreshold:::expand_column_values('extra3', thedf$extra3, index_i=c(1, 3), index_j=c(2, 4))
distancethreshold:::expand_column_values('extra4', thedf$extra4, index_i=c(1, 3), index_j=c(2, 4))

jaredlander/distancethreshold documentation built on June 10, 2025, 1:56 a.m.