sfc_to_df: sfc to df

Description Usage Arguments Examples

View source: R/df.R

Description

Converts an sfc object to a data.frame

Usage

1
sfc_to_df(sfc)

Arguments

sfc

sfc object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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 Dec. 1, 2020, 1:07 a.m.