How to combine sfc objects from R package sf

Using the R package sf, how does one combine sfc objects? For example, given the following code, how would one create a single sfc object sfc12 that includes the geometries from both sfc1 and sfc2? (length(sfc12) should be 2.)

library(sf)
pt1 = st_point(c(0,1))
pt2 = st_point(c(1,1))
sfc1 = st_sfc(pt1) # An sfc object
sfc2 = st_sfc(pt2) # Another sfc object
# sfc12 = ?

Some approaches that don't work:

sf_sfc(sfc1, sfc2)
# Error in vapply(lst, class, rep("", 3)) : values must be length 3,
# but FUN(X[]) result is length 2

sfc1 + sfc2 # Seems to add the points coordinate-wise.
# Geometry set for 1 feature
# geometry type:  POINT
# dimension:      XY
# bbox:           xmin: 1 ymin: 2 xmax: 1 ymax: 2
# epsg (SRID):    NA
# proj4string:    NA
# POINT(1 2)

rbind(sfc1, sfc2)
# [,1]
# sfc1 Numeric,2
# sfc2 Numeric,2

Just use c like its a vector:

> (sfc12 = c(sfc1, sfc2))
Geometry set for 2 features
geometry type:  POINT
dimension:      XY
bbox:           xmin: 0 ymin: 1 xmax: 1 ymax: 1
epsg (SRID):    NA
proj4string:    NA
POINT(0 1)
POINT(1 1)

And the length is 2:

> length(sfc12)
 2
• and how would you combine numerous sfc objects e.g. from a list of sfc objects? Feb 21 '18 at 14:05
• did you solve it Bernd? I am also not finding a convenient way to do it. Mar 10 '18 at 7:27
• @Marco if this is an issue for you and Bernd then start a new question with a reproducible example. Mar 10 '18 at 8:06
• @Marco do.call(c, list(sfc1, sfc2)) worked for me. Mar 10 '18 at 15:24
• Combine a list of sfc objects using Reduce(c, sfcs) or purrr::reduce(sfcs , c) May 7 '18 at 14:49

Drawing from @TimSalabim's answer, if your sfc objects are in the same CRS you can use

do.call(rbind, list(sfc1, sfc2)).

In case you want to iterate over a large set of data

sfc_combined = st_sfc()

for(i in c(1:2))

{

sfc_combined = rbind(sfc_combined, st_as_sf(sfc[i]))

}

comes in handy when combining multiple sfc into one