Learn R Programming

wakefield (version 0.3.6)

r_insert: Insert Data Frames Into r_data_frame

Description

Safely insert data.frame objects into a r_data_frame or r_list.

Usage

r_insert(x, name = "Inserted")

Arguments

x

A data.frame to add a seriesname attribute (i.e., attributes(x)[["seriesname"]])

name

A name to assign to attributes(x)[["seriesname"]].

Value

Returns a data.frame with a attributes(x)[["seriesname"]] assigned.

See Also

seriesname

Examples

Run this code
# NOT RUN {
dat <- dplyr::data_frame(
    Age_1 = age(100), Age_2 = age(100), Age_3 = age(100),
    Smokes = smokes(n=100),
    Sick = ifelse(Smokes, sample(5:10, 100, TRUE), sample(0:4, 100, TRUE)),
    Death = ifelse(Smokes, sample(0:1, 100, TRUE, prob = c(.2, .8)),
        sample(0:1, 100, TRUE, prob = c(.7, .3)))
)

r_data_frame(100,
   id,
   r_insert(dat)
)

r_list(10,
   id,
   r_insert(dat)
)
# }

Run the code above in your browser using DataLab