transform(`_data`, ...) transform.default(`_data`, ...) transform.data.frame(`_data`, ...)
`_data` | the object to be transformed. |
... | other arguments to pass in. Should have the format tag = expression. |
# Get a small subset of the "air" data frame d <- Sdatasets::air[1:10, 1:4]# Update the "temperature" column with degree Celsius, and # divided "radiation" by 10. transform(d, temperature=(temperature-32)*5/9, radiation=radiation/10.0)
# Add a new column "ctemp" with degree Celsius. transform(d, ctemp = (temperature-32)*5/9)
# Adapt to vector, transform.default is used first. transform(d$temperature, ctemp = (d$temperature-32)*5/9)
y <- 1:12 transform(y, SIN = sin(y), COS = cos(y)) # Almost similar to: data.frame(y, SIN = sin(y), COS = cos(y)) # except for difference of the first column name.