sf (version 0.9-3)

transform.sf: transform method for sf objects

Description

Can be used to create or modify attribute variables; for transforming geometries see st_transform, and all other functions starting with st_.

Usage

# S3 method for sf
transform(`_data`, ...)

Arguments

_data

object of class sf

...

Further arguments of the form new_variable=expression

Examples

Run this code
# NOT RUN {
a = data.frame(x1 = 1:3, x2 = 5:7)
st_geometry(a) = st_sfc(st_point(c(0,0)), st_point(c(1,1)), st_point(c(2,2)))
transform(a, x1_sq = x1^2)
transform(a, x1_x2 = x1*x2)
# }

Run the code above in your browser using DataCamp Workspace