write_derived_data: Write derived data file

Description Usage Arguments Details Value See Also Examples

View source: R/derived-data-prep.R

Description

[Stable]

Will write a dataset and an .RDS version of it to the (by default) "DerivedData" directory. The main benefit of the .RDS dataset is that functions like input_data() and output_table() can use it for rapid reading speeding up overall function.

Usage

1

Arguments

d

A data.frame. Data frame to be saved.

name

Character. Name of file (with or without extension). If not a path, will save to DerivedData directory.

...

Additional arguments to be passed to utils::write.csv().

Details

If there is no "DerivedData" data directory and you are using a different structure the argument name must be a (relative) path to an existing directory where you want your NONMEM ready dataset to be stored.

Value

No return value, called for side effects.

See Also

read_derived_data(), input_data(), exclude_rows()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## requires NMproject directory structure to operate in
## Not run: 

## read a dataset that's been copie into SourceData
d <- read.csv("SourceData/orig_data.csv")

## modify it
d <- d[d$ID < 10, ]

d %>% write_derived_data("DerivedData/data.csv")

## load it again either with
d <- read_derived_data("data")

## or more commonly if it is associated with run (e.g. m1),
## you can use input_data() to load it via the nm object

d <- input_data(m1)

## End(Not run)

NMproject documentation built on Oct. 18, 2021, 1:08 a.m.