expandrows: Function 'expand'

Description Usage Arguments See Also Examples

Description

Expand the rows of a data frame Copied and modified from remakeGenerator::expand() under GPL>=3: https://github.com/wlandau/remakeGenerator

Usage

1
expandrows(df, n = 2, type = c("each", "times"))

Arguments

df

data frame

n

number of duplicates per row

type

character scalar. If 'each', rows will be duplicated in place. If 'times', the data frame itself will be repeated n times.

See Also

wildcard]

Examples

1
2
3
4
5
df <- data.frame(
  ID = c('24601', 'Javert', 'Fantine'),
  fate = c('fulfillment', 'confusion', 'misfortune'))
expandrows(df, n = 2, type = 'each')
expandrows(df, n = 2, type = 'times')

wlandau/wildcard documentation built on May 21, 2019, 2:23 p.m.