All Projects → dcooley → sfheaders

dcooley / sfheaders

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
Build sf objects from R and Rcpp

Programming Languages

r
7636 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to sfheaders

RcppMeCab
RcppMeCab: Rcpp Interface of CJK Morpheme Analyzer MeCab
Stars: ✭ 24 (-65.71%)
Mutual labels:  rcpp
scanstatistics
An R package for space-time anomaly detection using scan statistics.
Stars: ✭ 41 (-41.43%)
Mutual labels:  rcpp
bh
R package providing Boost Header files
Stars: ✭ 73 (+4.29%)
Mutual labels:  rcpp
r-sparsepp
Rcpp interface to sparsepp - efficient hash map for C++
Stars: ✭ 12 (-82.86%)
Mutual labels:  rcpp
WeightedTreemaps
Create Voronoi and Sunburst Treemaps from Hierarchical data
Stars: ✭ 33 (-52.86%)
Mutual labels:  rcpp
gmwm
Generalized Method of Wavelet Moments (GMWM) is an estimation technique for the parameters of time series models. It uses the wavelet variance in a moment matching approach that makes it particularly suitable for the estimation of certain state-space models.
Stars: ✭ 21 (-70%)
Mutual labels:  rcpp
RcppXPtrUtils
XPtr Add-Ons for 'Rcpp'
Stars: ✭ 17 (-75.71%)
Mutual labels:  rcpp
joineRML
R package for fitting joint models to time-to-event data and multivariate longitudinal data
Stars: ✭ 24 (-65.71%)
Mutual labels:  rcpp
shapr
Explaining the output of machine learning models with more accurately estimated Shapley values
Stars: ✭ 95 (+35.71%)
Mutual labels:  rcpp
colourvalues
R library for assigning colours to values
Stars: ✭ 41 (-41.43%)
Mutual labels:  rcpp
inline
Inline C, C++ or Fortran functions in R
Stars: ✭ 33 (-52.86%)
Mutual labels:  rcpp
rdoxygen
Create doxygen documentation for R package C++ code
Stars: ✭ 15 (-78.57%)
Mutual labels:  rcpp
rcppensmallen
Rcpp integration for the Ensmallen templated C++ mathematical optimization library
Stars: ✭ 28 (-60%)
Mutual labels:  rcpp
rcpp-api
Source for the Unofficial Rcpp API Documentation
Stars: ✭ 42 (-40%)
Mutual labels:  rcpp
rcppgsl
Rcpp integration for GNU GSL vectors and matrices
Stars: ✭ 28 (-60%)
Mutual labels:  rcpp
rcpparrayfire
R and ArrayFire library via Rcpp
Stars: ✭ 17 (-75.71%)
Mutual labels:  rcpp
splines2
Regression Spline Functions and Classes
Stars: ✭ 21 (-70%)
Mutual labels:  rcpp
RcppML
Rcpp Machine Learning: Fast robust NMF, divisive clustering, and more
Stars: ✭ 52 (-25.71%)
Mutual labels:  rcpp
Badssl.com
🔒 Memorable site for testing clients against bad SSL configs.
Stars: ✭ 2,234 (+3091.43%)
Mutual labels:  rcpp
rcppredis
R interface to Redis using the hiredis library
Stars: ✭ 45 (-35.71%)
Mutual labels:  rcpp

R build status Coverage status downloads CRAN RStudio mirror downloads

Another spatial library?

Yep. In a few of my other libraries I’ve made use of sf objects, but without importing the sf library itself. This is by design because sf is quite a ‘heavy’ library.

Therefore I’ve written / copied these methods for constructing the sf objects across a few different libraries.

So I thought it would be useful to have these in one place. And here they are.

Does it really make sf objects?

Yes and No. 

These functions do not perform any validity checks on the geometries. Nor do they set Coordinate Reference Systems, EPSG, PROJ4 or precision attributes.

What they do is convert R and Rcpp objects (vectors, matrices and data.frames) into the correct sf class structure, so you can then assign these values yourself.

Are there any catches?

Yes. Your data has to be ordered before coverting to sf.

Where are the examples?

They’re on the website. GO NOW!

(however, here’s a taster)

df <- data.frame(
  id = c(1,1,1,1,1,2,2,2,2,2)
  , x = c(1,2,2,1,1,3,4,4,3,3)
  , y = c(1,1,2,2,1,3,3,4,4,3)
)

df$val <- letters[df$id]

sfheaders::sf_linestring( df, x = "x", y = "y", linestring_id = "id", keep = TRUE )

# Simple feature collection with 2 features and 2 fields
# geometry type:  LINESTRING
# dimension:      XY
# bbox:           xmin: 1 ymin: 1 xmax: 4 ymax: 4
# epsg (SRID):    NA
# proj4string:    NA
#   id val                       geometry
# 1  1   a LINESTRING (1 1, 2 1, 2 2, ...
# 2  2   b LINESTRING (3 3, 4 3, 4 4, ...

sfheaders::sf_polygon( df, x = "x", y = "y", polygon_id = "id" , keep = TRUE )

# Simple feature collection with 2 features and 2 fields
# geometry type:  POLYGON
# dimension:      XY
# bbox:           xmin: 1 ymin: 1 xmax: 4 ymax: 4
# epsg (SRID):    NA
# proj4string:    NA
#   id val                       geometry
# 1  1   a POLYGON ((1 1, 2 1, 2 2, 1 ...
# 2  2   b POLYGON ((3 3, 4 3, 4 4, 3 ...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].