expandrows {wildcard}R Documentation

Function expand

Description

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

Usage

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

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')

[Package wildcard version 1.1.0 Index]