From 7f0e42afa29de0c9ed0a4bc510a411b25049184e Mon Sep 17 00:00:00 2001 From: SymbolixAU Date: Fri, 18 Jan 2019 21:03:05 +1100 Subject: [PATCH] cran realease --- DESCRIPTION | 2 +- cran-comments.md | 14 +++-- .../include/spatialwidget/geojson/geojson.hpp | 60 +++++++++---------- tests/testthat/test-legends.R | 20 +++++-- 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6623ad4..265f135 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: spatialwidget Type: Package Title: Converts Spatial Data to Javascript Object Notation (JSON) for Use in Htmlwidgets Version: 0.2 -Date: 2019-01-13 +Date: 2019-01-18 Authors@R: c( person("David", "Cooley", ,"dcooley@symbolix.com.au", role = c("aut", "cre")) ) diff --git a/cran-comments.md b/cran-comments.md index 3ca1add..1c33a95 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,10 +1,16 @@ + +## Release Notes + +* Updates v0.1 to v0.2 +* CRAN Check NOTES: large installed package size + - This library has a lot of required source C++ files which I can't remove + + ## Test environments -* local OS X install, R 3.5.0 +* local OS X install, R 3.5.1 * ubuntu 14.04 (on travis-ci), R 3.5.0 * win-builder (devel and release) ## R CMD check results -0 errors | 0 warnings | 1 note - -* This is a new release. +0 errors | 0 warnings | 0 notes diff --git a/inst/include/spatialwidget/geojson/geojson.hpp b/inst/include/spatialwidget/geojson/geojson.hpp index 19a1dbb..0c6af7d 100644 --- a/inst/include/spatialwidget/geojson/geojson.hpp +++ b/inst/include/spatialwidget/geojson/geojson.hpp @@ -26,9 +26,9 @@ namespace geojson { int n_geometries = geometries.size(); int geom; - size_t n_cols = sf.ncol(); - size_t n_properties = n_cols - n_geometries; - size_t n_rows = sf.nrows(); + int n_cols = sf.ncol(); + int n_properties = n_cols - n_geometries; + int n_rows = sf.nrows(); int i, j; Rcpp::StringVector column_names = sf.names(); Rcpp::StringVector property_names( n_properties ); @@ -100,18 +100,18 @@ namespace geojson { const char* geom_column = geometry.c_str(); - size_t n_cols = sf.ncol(); - size_t n_properties = n_cols - 1; // single geometry column - size_t n_rows = sf.nrows(); + int n_cols = sf.ncol(); + int n_properties = n_cols - 1; // single geometry column + int n_rows = sf.nrows(); int i, j, i_geometry; Rcpp::StringVector column_names = sf.names(); Rcpp::StringVector property_names(sf.size() - 1); - size_t property_multiplier = 0; + int property_multiplier = 0; std::string geom_type; Rcpp::CharacterVector cls; - size_t property_counter = 0; + int property_counter = 0; for ( i = 0; i < n_cols; i++ ) { Rcpp::String this_column = column_names[i]; @@ -186,22 +186,22 @@ namespace geojson { int digits) { - size_t n_geometries = geometries.size(); + int n_geometries = geometries.size(); if ( n_geometries != 2 ) { Rcpp::stop("Only supports 2-column sf objects"); } - size_t n_cols = sf.ncol(); - size_t n_rows = sf.nrows(); + int n_cols = sf.ncol(); + int n_rows = sf.nrows(); int i, j; - size_t geometry, geometry_column; + int geometry, geometry_column; Rcpp::StringVector column_names = sf.names(); Rcpp::StringVector property_names(sf.size() - 1); std::string geom_type; Rcpp::CharacterVector cls; - size_t property_counter = 0; + int property_counter = 0; for ( i = 0; i < n_cols; i++) { Rcpp::String this_column = column_names[i]; @@ -220,7 +220,7 @@ namespace geojson { for( i = 0; i < n_rows; i++ ) { int geometry_size = 0; - size_t row_multiplier = 0; + int row_multiplier = 0; Rcpp::IntegerVector geometry_sizes( n_geometries ); for ( geometry = 0; geometry < n_geometries; geometry++ ) { @@ -324,9 +324,9 @@ namespace geojson { rapidjson::StringBuffer sb; rapidjson::Writer < rapidjson::StringBuffer > writer( sb ); - size_t n_cols = sf.ncol(); - size_t n_properties = n_cols - 1; - size_t n_rows = sf.nrows(); + int n_cols = sf.ncol(); + int n_properties = n_cols - 1; + int n_rows = sf.nrows(); int i, j; Rcpp::StringVector column_names = sf.names(); Rcpp::StringVector property_names(sf.size() - 1); @@ -385,14 +385,14 @@ namespace geojson { int digits ) { - size_t n_cols = df.ncol(); - size_t n_rows = df.nrows(); + int n_cols = df.ncol(); + int n_rows = df.nrows(); - size_t n_lons = geometries.size(); - size_t n_lats = geometries.size(); // it is expected the lon & lat data is the same size because + int n_lons = geometries.size(); + int n_lats = geometries.size(); // it is expected the lon & lat data is the same size because - size_t n_lonlat = n_lons + n_lats; - size_t n_properties = n_cols - n_lonlat; // LON & LAT columns + int n_lonlat = n_lons + n_lats; + int n_properties = n_cols - n_lonlat; // LON & LAT columns // it comes as columns on a data.frame int i, j; @@ -488,15 +488,15 @@ namespace geojson { int digits ) { - size_t n_cols = df.ncol(); - size_t n_rows = df.nrows(); + int n_cols = df.ncol(); + int n_rows = df.nrows(); - size_t n_lons = geometries.size(); - size_t n_lats = geometries.size(); // it is expected the lon & lat data is the same size because - size_t n_elevs = geometries.size(); + int n_lons = geometries.size(); + int n_lats = geometries.size(); // it is expected the lon & lat data is the same size because + int n_elevs = geometries.size(); - size_t n_lonlat = n_lons + n_lats + n_elevs; - size_t n_properties = n_cols - n_lonlat; // LON & LAT & ELEV columns + int n_lonlat = n_lons + n_lats + n_elevs; + int n_properties = n_cols - n_lonlat; // LON & LAT & ELEV columns // it comes as columns on a data.frame int i, j; diff --git a/tests/testthat/test-legends.R b/tests/testthat/test-legends.R index 3941094..9f070c0 100644 --- a/tests/testthat/test-legends.R +++ b/tests/testthat/test-legends.R @@ -64,7 +64,13 @@ test_that("legends are formatted", { expect_equal( as.character( res$legend ), '{"fill_colour":{"colour":["#440154FF","#31688EFF","#35B779FF","#FDE725FF"],"variable":["2018-01-01","2018-01-02","2018-01-03","2018-01-04"],"colourType":["fill_colour"],"type":["gradient"],"title":["col"],"css":[""]}}') ## POSIXct - df <- data.frame(lon = c(1,2,-5,0.3), lat = 1:4, col = seq(as.POSIXct("2018-01-01"), as.POSIXct("2018-01-04"), length.out = 4)) + df <- data.frame( + lon = c(1,2,-5,0.3) + , lat = 1:4 + , col = seq(as.POSIXct("2018-01-01", tz= "UTC") + , as.POSIXct("2018-01-04", tz="UTC") + , length.out = 4) + ) res <- spatialwidget::widget_point( data = df @@ -73,10 +79,16 @@ test_that("legends are formatted", { , fill_colour = "col" ) - expect_equal( as.character( res$legend ), '{"fill_colour":{"colour":["#440154FF","#31688EFF","#35B779FF","#FDE725FF"],"variable":["2017-12-31T13:00:00","2018-01-01T13:00:00","2018-01-02T13:00:00","2018-01-03T13:00:00"],"colourType":["fill_colour"],"type":["gradient"],"title":["col"],"css":[""]}}') + expect_equal( as.character( res$legend ), '{"fill_colour":{"colour":["#440154FF","#31688EFF","#35B779FF","#FDE725FF"],"variable":["2018-01-01T00:00:00","2018-01-02T00:00:00","2018-01-03T00:00:00","2018-01-04T00:00:00"],"colourType":["fill_colour"],"type":["gradient"],"title":["col"],"css":[""]}}') ## POSIXlt (as POSIXct because in data.frame) - df <- data.frame(lon = c(1,2,-5,0.3), lat = 1:4, col = seq(as.POSIXlt("2018-01-01"), as.POSIXlt("2018-01-04"), length.out = 4)) + df <- data.frame( + lon = c(1,2,-5,0.3) + , lat = 1:4 + , col = seq(as.POSIXlt("2018-01-01", tz="UTC") + , as.POSIXlt("2018-01-04", tz="UTC") + , length.out = 4) + ) res <- spatialwidget::widget_point( data = df @@ -85,7 +97,7 @@ test_that("legends are formatted", { , fill_colour = "col" ) - expect_equal( as.character( res$legend ), '{"fill_colour":{"colour":["#440154FF","#31688EFF","#35B779FF","#FDE725FF"],"variable":["2017-12-31T13:00:00","2018-01-01T13:00:00","2018-01-02T13:00:00","2018-01-03T13:00:00"],"colourType":["fill_colour"],"type":["gradient"],"title":["col"],"css":[""]}}') + expect_equal( as.character( res$legend ), '{"fill_colour":{"colour":["#440154FF","#31688EFF","#35B779FF","#FDE725FF"],"variable":["2018-01-01T00:00:00","2018-01-02T00:00:00","2018-01-03T00:00:00","2018-01-04T00:00:00"],"colourType":["fill_colour"],"type":["gradient"],"title":["col"],"css":[""]}}') })