sfc_to_df: sfc to df

View source: R/df.R

sfc_to_dfR Documentation

sfc to df

Description

Converts an sfc object to a data.frame

Usage

sfc_to_df(sfc)

Arguments

sfc

sfc object

Examples


x <- matrix( c(1:16), ncol = 2 )
sfc <- sfc_linestring( x )
df <- sfc_to_df( sfc )

df <- data.frame(
ml_id = c(1,1,1,1,1,1,1,1,2,2,2,2,2)
, l_id = c(1,1,1,2,2,3,3,3,1,1,1,2,2)
, x = rnorm(13)
, y = rnorm(13)
, z = rnorm(13)
, m = rnorm(13)
)
sfc <- sfc_multilinestring( obj = df, multilinestring_id = "ml_id", linestring_id = "l_id" )

df <- sfc_to_df( sfc )


sfheaders documentation built on July 9, 2023, 7:41 p.m.