mutate | R Documentation |
Mutate and transmutate a data.frame.
mutate_(df, ...)
transmutate_(df, ...)
df |
data.frame |
... |
formula used for mutating/transmutating the data.frame |
The functions return a data frame. The output has the following properties:
For function mutate_()
, output includes all df
columns.
In addition, new columns are created according to argument ...
and placed after the others.
For function transmutate_()
, output includes only columns created according to argument ...
and placed after the others.
tmp <- mutate_(CO2,z=~conc/uptake)
head(tmp)
# Return an warning: expression mean(uptake) get a result with 'nrow' different from 'df'
# tmp <- mutate_(CO2,mean=~mean(uptake))
tmp <- mutate_(CO2,z1=~uptake/conc,y=~conc/100)
head(tmp)
tmp <- transmutate_(CO2,z2=~uptake/conc,y2=~conc/100)
head(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.