R: sfc to df

sfc_to_df {sfheaders} | R Documentation

## sfc to df

### Description

Converts an sfc object a to 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 )

[Package sfheaders version 0.2.1 Index]