Giter Site home page Giter Site logo

cpanse / recmap Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 1.0 20.8 MB

An algorithm to draw rectangular statistical cartograms - CRAN package

Home Page: https://CRAN.R-project.org/package=recmap

License: GNU General Public License v3.0

C++ 56.32% R 43.68%
cartogram spatial-data-analysis geovisualization demographics value-by-area-maps spatial graph-drawing cran-r genetic-algorithm

recmap's Introduction

CRAN_Status_Badge Research software impact JSS codecov

recmap - Compute the Rectangular Statistical Cartogram

This package implements the RecMap construction algorithm (MP2) using the GA CRAN package as metaheuristic.

rectangular population cartogram construction demo - animated gif

1. Installation

use CRAN

recmap requires R 3.6 or later.

Released and tested versions of recmap are available via CRAN, and can be installed using the following code

install.packages('recmap')

before running R CMD build and R CMD check or running the shiny demo execute

pkgs <- c('colorspace', 'doParallel', 'DT', 'knitr', 'maps',
  'shiny', 'testthat', 'tufte')
pkgs <- pkgs[(!pkgs %in% unique(installed.packages()[,'Package']))]
if(length(pkgs) > 0){install.packages(pkgs)}

2. Documentation

The package ships with a package vignette (browseVignettes('recmap')) and a reference manual (just type ?recmap on the R shell). Both documents are also available on the package's CRAN page. A white paper containing more technical information and examples is available through jss.v086.c01.

3. Demonstration

Run an interactive shiny application

library(recmap)
GA::gaControl("useRcpp" = FALSE) # apple M1
recmap_shiny <- system.file('shiny-examples', package = 'recmap')
shiny::runApp(recmap_shiny, display.mode = 'normal')

Run the recmap shiny demonstration as a stand-alone application using Linux and macOS systems use the Terminal application add the following code to your alias file, e.g., $HOME/.bashrc

alias recmapShiny="R -e \"library(shiny); \
  recmap_shiny <- system.file('shiny-examples', package = 'recmap'); \
  shiny::runApp(recmap_shiny, display.mode = 'normal', launch.browser=TRUE)\""

execute

. $HOME/.bashrc && recmapShiny

4. (Frequently) Asked Questions

4.1 Is there an easy way to convert a recmap object to an sf object?

Use as.SpatialPolygonsDataFrame, see also issue #13. The as.recmap function performs the transformation from a SpatialPolygonsDataFrame into a recmap compatible object.

5. Related approaches

recmap's People

Contributors

cpanse avatar eddelbuettel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

eddelbuettel

recmap's Issues

Provide a sf::st_as_sf.recmap method?

Nice package! It would be great if there was an easy way convert a recmap object to an sf object to make it easier to visualize outside of plot()

STRICT_R_HEADERS via Rcpp

Moving towards STRICT_R_HEADERS by default

Summary

tl;dr: STRICT_R_HEADERS are a worthwhile change, and we want to make that
change in one year. If your package is affected, you should get
another email and we ask that you make the change within 12 months.

More details below.

What is this about?

Recently Romain opened ticket #898 on Github about possibly adding the define
for STRICT_R_HEADERS by default. Please see the URL at
RcppCore/Rcpp#898
for more discussion. In general, we are all in favour but there are some side
effects. Hence this email.

Background

What does the change do? As a brief summary, this only hits two R include
files and, if set, omits the definitions from two header files in R_ext/,
namely RS.h and Constants.h. The definitions are (indented by two spaces)

#ifndef STRICT_R_HEADERS

#define R_PROBLEM_BUFSIZE 4096
/* Parentheses added for FC4 with gcc4 and -D_FORTIFY_SOURCE=2 */
#define PROBLEM {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
#define MESSAGE {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
#define ERROR ),error(R_problem_buf);}
#define RECOVER(x) ),error(R_problem_buf);}
#define WARNING(x) ),warning(R_problem_buf);}
#define LOCAL_EVALUATOR //
#define NULL_ENTRY /
/
#define WARN WARNING(NULL)

#endif

and

#ifndef STRICT_R_HEADERS
/* S-PLUS 3.x but not 5.x NULLs the pointer in the following */
#define Calloc(n, t) (t *) R_chk_calloc( (R_SIZE_T) (n), sizeof(t) )
#define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (R_SIZE_T)((n) * sizeof(t)) )
#define Free(p) (R_chk_free( (void *)(p) ), (p) = NULL)
#endif

and

#ifndef STRICT_R_HEADERS
#define PI M_PI
#include <float.h> /* Defines the rest, at least in C99 */
#define SINGLE_EPS FLT_EPSILON
#define SINGLE_BASE FLT_RADIX
#define SINGLE_XMIN FLT_MIN
#define SINGLE_XMAX FLT_MAX
#define DOUBLE_DIGITS DBL_MANT_DIG
#define DOUBLE_EPS DBL_EPSILON
#define DOUBLE_XMAX DBL_MAX
#define DOUBLE_XMIN DBL_MIN
#endif

The second sets is easiest. Just replace Calloc / Realloc / Free (if you
really need it!) with R_Calloc / R_Realloc / R_Free. The third is easy too:
instead of PI use M_PI and so on. The first set is problematic and where I
have most often seen clashes (requiring change in include order, or #undef ERROR, or, ...). But R itself has Rf_error, Rf_warning, ... And Rcpp itself
has Rcpp::stop() and Rcpp::warning() and more.

What is the effect?

We ran full reverse depends check last weekend and found 62 packages failed
to compiled (but almost 1300 passes, 62 were skipped for various reasons).

The failing packages are list at the #898 issue ticket and below.

What changes are needed?

The really good news is that the changes should be trivial:

  • replace PI with M_PI
  • replace DBL_EPSILON with DOUBLE_EPS
  • replace Calloc with R_Calloc

and so on.

If you really cannot / do not want to make the change, define
#RCPP_NO_STRICT_HEADERS
before #include <Rcpp.h> and things will be as before. Otherwise we plan to
make this a new default in twelve months.

How can you test things?

In your package, please just add the line #define STRICT_R_HEADERS before
including Rcpp.h, ie use (ignore the twp space indent)

#define STRICT_R_HEADERS
#include <Rcpp.h>

or, even simpler, set -DSTRICT_R_HEADERS in eg CXXFLAGS in ~/.R/Makevars.

How can you override things?

Define RCPP_NO_STRICT_R_HEADERS and things will remain as they are.

You can do that locally in you compiler-flags for now, and in your package in
either its compiler flags (ie src/Makevars and src/Makevars.win) or your
headers if you do not want to change your code to work with STRICT_R_HEADERS.
However, we feel working with STRICT_R_HEADERS is an improvement so we
suggest you set it now and work out the (likely few and simple) compilation
errors.

Details logs

Below is a collated grep run finding the first (and hence NOT EXHAUSTIVE)
failure per package.

** CorReg :
BicLoc_cpp.cpp:70:53: error: ‘PI’ was not declared in this scope

** CoxPlus :
coxReg.cpp:333:84: error: ‘DBL_MAX’ was not declared in this scope
coxReg.cpp:415:16: error: ‘DBL_MAX’ was not declared in this scope
coxReg.cpp:426:16: error: ‘DBL_MAX’ was not declared in this scope
coxReg.cpp:943:16: error: ‘DBL_MAX’ was not declared in this scope

** DGM :
dlmlpl.cpp:106:64: error: ‘PI’ was not declared in this scope

** EMVS :
functions.cpp:20:30: error: ‘PI’ was not declared in this scope
functions.cpp:27:37: error: ‘PI’ was not declared in this scope
functions.cpp:142:23: error: ‘PI’ was not declared in this scope

** ETAS :
fitMP.cpp:2107:28: error: ‘DBL_MAX’ was not declared in this scope

** GAS :
snorm.cpp:14:45: error: ‘PI’ was not declared in this scope
snorm.cpp:26:23: error: ‘PI’ was not declared in this scope
snorm.cpp:37:28: error: ‘PI’ was not declared in this scope
snorm.cpp:52:26: error: ‘PI’ was not declared in this scope
snorm.cpp:64:26: error: ‘PI’ was not declared in this scope
snorm.cpp:146:28: error: ‘PI’ was not declared in this scope

** Gmisc :
Gmisc_lines.cpp:107:20: error: ‘FLT_EPSILON’ was not declared in this scope

** HardyWeinberg :
SNPHWEX.cpp:84:21: error: ‘DBL_MAX’ was not declared in this scope
SNPHWEX.cpp:130:21: error: ‘DBL_MAX’ was not declared in this scope
SNPHWEX.cpp:360:21: error: ‘DBL_MAX’ was not declared in this scope
SNPHWEX.cpp:421:21: error: ‘DBL_MAX’ was not declared in this scope
SNPHWEX.cpp:587:21: error: ‘DBL_MAX’ was not declared in this scope

** MAINT.Data :
msnCP_dev.h:8:26: error: ‘PI’ was not declared in this scope
msnCP_dev.cpp:8:29: error: ‘PI’ was not declared in this scope
msnCP_dev.cpp:41:36: error: ‘PI’ was not declared in this scope
msnCP_dev_grad.cpp:7:26: error: ‘PI’ was not declared in this scope

** MSGARCH :
Utils.h:8:28: error: ‘DBL_MIN’ was not declared in this scope

** MultiFit :
singleFisher.cpp:25:19: error: ‘DBL_MIN’ was not declared in this scope
singleFisher.cpp:30:37: error: ‘DBL_MIN’ was not declared in this scope

** PAFit :
Cpp_code.cpp:751:41: error: ‘DBL_EPSILON’ was not declared in this scope
Cpp_code.cpp:969:17: error: ‘LDBL_EPSILON’ was not declared in this scope

** ReIns :
SpliceEM_Mstep.cpp:192:13: error: ‘DBL_MAX’ was not declared in this scope
SpliceEM_Mstep.cpp:200:17: error: ‘DBL_MAX’ was not declared in this scope
SpliceEM_Mstep.cpp:270:11: error: ‘DBL_MAX’ was not declared in this scope
SpliceEM_Mstep.cpp:278:15: error: ‘DBL_MAX’ was not declared in this scope

** basad :
utiliti.cpp:36:17: error: ‘PI’ was not declared in this scope

** bayesImageS :
smcPotts.cpp:343:17: error: ‘DBL_EPSILON’ was not declared in this scope

** bcp :
MCMC.h:119:16: error: ‘DBL_MAX’ was not declared in this scope
MCMC.h:135:16: error: ‘DBL_MAX’ was not declared in this scope
Cbcp.cpp:134:15: error: ‘DBL_MAX’ was not declared in this scope

** bfa :
bfa_common.cpp:25:15: error: ‘DBL_MAX’ was not declared in this scope

** bigReg :
map_reg.cpp:53:16: error: ‘DBL_EPSILON’ was not declared in this scope

** biglasso :
binomial_hsr.cpp:6:9: error: ‘Free’ was not declared in this scope
binomial_hsr.cpp:162:31: error: ‘Calloc’ was not declared in this scope

** bigmemory :
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:34:18: error: ‘FLT_MIN’ was not declared in this scope
../inst/include/bigmemory/bigmemoryDefines.h:35:20: error: ‘FLT_MAX’ was not declared in this scope

** binnednp :
gaussian_mise_201708_trsf.cpp:40:46: error: ‘PI’ was not declared in this scope

** biwavelet :
rcpp_wt_bases_morlet.cpp:4:28: error: ‘PI’ was not declared in this scope

** blockmodels :
models/gaussian.h:292:71: error: ‘PI’ was not declared in this scope
models/gaussian.h:366:67: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate.h:302:93: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate.h:390:91: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate_independent.h:300:79: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate_independent.h:381:79: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate_independent_homoscedastic.h:293:88: error: ‘PI’ was not declared in this scope
models/gaussian_multivariate_independent_homoscedastic.h:373:86: error: ‘PI’ was not declared in this scope
models/gaussian_covariates.h:383:71: error: ‘PI’ was not declared in this scope
models/gaussian_covariates.h:431:71: error: ‘PI’ was not declared in this scope
models/gaussian_covariates.h:478:69: error: ‘PI’ was not declared in this scope

** castor :
phylogenetics_cpp_routines.cpp:1559:67: error: ‘PI’ was not declared in this scope

** cbinom :
cbinom.cpp:5:20: error: ‘DBL_EPSILON’ was not declared in this scope

** circumplex :
circular.cpp:18:11: error: ‘DBL_EPSILON’ was not declared in this scope
circular.cpp:31:20: error: ‘PI’ was not declared in this scope
circular.cpp:34:12: error: ‘PI’ was not declared in this scope
circular.cpp:43:20: error: ‘PI’ was not declared in this scope
circular.cpp:48:37: error: ‘DBL_EPSILON’ was not declared in this scope
circular.cpp:66:21: error: ‘PI’ was not declared in this scope

** emIRT :
calcLB.cpp:86:46: error: ‘PI’ was not declared in this scope

** extraDistr :
wald-distribution.cpp:40:27: error: ‘PI’ was not declared in this scope

** fDMA :
tvpcpp.cpp:31:54: error: ‘PI’ was not declared in this scope

** facilitation :
Random.cpp:29:25: error: ‘PI’ was not declared in this scope

** fastGHQuad :
lib.cpp:331:49: error: ‘PI’ was not declared in this scope
lib.cpp:358:21: error: ‘PI’ was not declared in this scope

** fasteraster :
raster2vector.cpp:25:17: error: ‘DBL_MAX’ was not declared in this scope
raster2vector.cpp:25:17: error: ‘DBL_MAX’ was not declared in this scope
raster2vector.cpp:350:17: error: ‘PI’ was not declared in this scope
raster2vector.cpp:352:17: error: ‘PI’ was not declared in this scope
raster2vector.cpp:25:17: error: ‘DBL_MAX’ was not declared in this scope
raster2vector.cpp:25:17: error: ‘DBL_MAX’ was not declared in this scope

** frailtySurv :
distributions.cpp:217:38: error: ‘PI’ was not declared in this scope
distributions.cpp:225:35: error: ‘PI’ was not declared in this scope
distributions.cpp:234:61: error: ‘PI’ was not declared in this scope
distributions.cpp:335:25: error: ‘PI’ was not declared in this scope
distributions.cpp:342:35: error: ‘PI’ was not declared in this scope
distributions.cpp:354:11: error: ‘PI’ was not declared in this scope
distributions.cpp:459:24: error: ‘PI’ was not declared in this scope

** gcKrig :
gcgcFun.cpp:34:14: error: ‘DOUBLE_EPS’ was not declared in this scope
gcgcFun.cpp:40:47: error: ‘EPS1’ was not declared in this scope
gcgcFun.cpp:85:14: error: ‘DOUBLE_EPS’ was not declared in this scope
gcgcFun.cpp:100:45: error: ‘EPS1’ was not declared in this scope
gcgcFun.cpp:163:56: error: ‘EPS1’ was not declared in this scope

** geogrid :
minimal-assignment.cpp:407:21: error: ‘DBL_MAX’ was not declared in this scope

** glmBfp :
./types.h:53:32: error: ‘DOUBLE_EPS’ was not declared in this scope
./functionWraps.h:176:17: error: ‘DBL_MAX’ was not declared in this scope

** icenReg :
icenReg_files/basicUtilities.cpp:149:37: error: ‘PI’ was not declared in this scope

** lidR :
C_grid_canopy.cpp:58:31: error: ‘PI’ was not declared in this scope

** lpme :
lpme_common.cpp:45:30: error: ‘PI’ was not declared in this scope
lpme_common.cpp:111:51: error: ‘PI’ was not declared in this scope
lpme_common.cpp:150:51: error: ‘PI’ was not declared in this scope

** mcmcse :
msvec.cpp:16:21: error: ‘PI’ was not declared in this scope

** medfate :
PenmanMonteith.cpp:21:41: error: ‘PI’ was not declared in this scope

** meteoland :
radiation.cpp:56:40: error: ‘PI’ was not declared in this scope
radiation.cpp:76:19: error: ‘PI’ was not declared in this scope
radiation.cpp:98:46: error: ‘PI’ was not declared in this scope
radiation.cpp:136:19: error: ‘PI’ was not declared in this scope
radiation.cpp:187:40: error: ‘PI’ was not declared in this scope
radiation.cpp:228:40: error: ‘PI’ was not declared in this scope
radiation.cpp:291:63: error: ‘PI’ was not declared in this scope
radiation.cpp:344:16: error: ‘PI’ was not declared in this scope

** minimaxdesign :
kmeanspso.cpp:89:23: error: ‘DBL_MAX’ was not declared in this scope
kmeanspso.cpp:267:24: error: ‘DBL_MAX’ was not declared in this scope

** multdyn :
dlmlpl.cpp:106:64: error: ‘PI’ was not declared in this scope

** mwaved :
mwaved.cpp:2736:49: error: ‘DBL_EPSILON’ was not declared in this scope

** netdiffuseR :
plot.cpp:403:90: error: ‘PI’ was not declared in this scope
plot.cpp:481:20: error: ‘PI’ was not declared in this scope

** nngeo :
distance.cpp:15:22: error: ‘PI’ was not declared in this scope

** npsf :
nllpk/simplexMethod.cpp:260:21: error: ‘DBL_MAX’ was not declared in this scope
nllpk/simplexMethod.cpp:564:18: error: ‘DBL_MAX’ was not declared in this scope

** packcircles :
pmenzel_circle_pack.cpp:182:28: error: ‘FLT_MAX’ was not declared in this scope

** partialCI :
cfit.cc:179:41: error: ‘PI’ was not declared in this scope
cfit.cc:211:66: error: ‘PI’ was not declared in this scope

** pense :
InitialEstimator.cpp:185:21: error: ‘DBL_MAX’ was not declared in this scope

** precrec :
calc_uauc.cpp:26:14: error: ‘DBL_MIN’ was not declared in this scope
calc_uauc.cpp:28:14: error: ‘DBL_MAX’ was not declared in this scope

** recmap :
../inst/include/recmap.h:114:35: error: ‘PI’ was not declared in this scope
../inst/include/recmap.h:126:35: error: ‘PI’ was not declared in this scope
../inst/include/recmap.h:138:43: error: ‘PI’ was not declared in this scope
../inst/include/recmap.h:150:39: error: ‘PI’ was not declared in this scope
../inst/include/recmap.h:384:38: error: ‘PI’ was not declared in this scope

** rmgarch :
ica.cpp:38:45: error: ‘PI’ was not declared in this scope

** robustlmm :
fastGHQuad.cpp:356:49: error: ‘PI’ was not declared in this scope
fastGHQuad.cpp:383:21: error: ‘PI’ was not declared in this scope

** rococo :
rcor_exacttest.cpp:142:29: error: ‘DBL_EPSILON’ was not declared in this scope

** rotations :
CppBayesFunctions.cpp:37:28: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:52:30: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:76:33: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:110:17: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:129:30: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:153:33: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:199:15: error: ‘PI’ was not declared in this scope
CppBayesFunctions.cpp:360:26: error: ‘PI’ was not declared in this scope

** rtdists :
CDF_st0_variability.h:126:20: error: ‘DBL_MAX’ was not declared in this scope

** serrsBayes :
mixVoigt.cpp:34:18: error: ‘PI’ was not declared in this scope
mixVoigt.cpp:44:25: error: ‘PI’ was not declared in this scope
mixVoigt.cpp:73:85: error: ‘PI’ was not declared in this scope
mixVoigt.cpp:99:50: error: ‘PI’ was not declared in this scope
mixVoigt.cpp:136:165: error: ‘PI’ was not declared in this scope
mixVoigt.cpp:252:37: error: ‘PI’ was not declared in this scope

** unmarked :
nll_distsamp.cpp:25:22: error: ‘DOUBLE_XMIN’ was not declared in this scope

** updog :
betabinom.cpp:5:21: error: ‘DBL_EPSILON’ was not declared in this scope

** vegclust :
trajectories.cpp:94:38: error: ‘PI’ was not declared in this scope

In case of question please discuss on the rcpp-devel list.

Thanks,

Dirk
on behalf of the RcppCore team

lambda capture 'this' is not used

cp@lilith:~ > R CMD INSTALL recmap_1.0.3.tar.gz 
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library’
* installing *source* package ‘recmap’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c Rrecmap.cpp -o Rrecmap.o
In file included from Rrecmap.cpp:26:
../inst/include/recmap.h:260:26: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    each_unique_pair(M, [this](map_region &a, map_region &b,
                         ^~~~
1 warning generated.
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include   -fPIC  -Wall -g -O2  -c recmap_init.c -o recmap_init.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o recmap.so RcppExports.o Rrecmap.o recmap_init.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.5/Resources/library/recmap/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (recmap)

all.equal.recmap : (target, current) -> {TRUE, FALSE} / if is not TRUE, then a string is returned

recmap:::all.equal.recmap
function (target, current, ...)
{
     all.equal(target$x, current$x) & all.equal(target$y, current$y) &
         all.equal(target$dx, current$dx) & all.equal(target$dy,
         current$dy) & all.equal(target$z, current$z) &
all.equal(target$name,
         current$name)
}

if all.equal(target$x, current$x) is not TRUE, then a string is
returned indicating what the difference is. This precludes the
combination with & and leads to when this function is called and objects
are not equal:

Error in all.equal(target$x, current$x) & all.equal(target$y, current$y) :
operations are possible only for numeric, logical or complex types

At least the use of isTRUE() should be considered to ensure that
scalar logicals are combined with &.

thanks to Bettina Gruen

add test cases of the angle difference

problem recmap (<0.5.29):

recmap_debug_rpe

bugfix


        if ((gammaM < 0 && gammaC > 0) || ( gammaM > 0 && gammaC < 0))
          delta = fabs(gammaC + gammaM) / C.size();
        else
          delta = fabs(gammaC - gammaM) / C.size();

testthat

R> set.seed(1); (sapply(1:10, function(i){summary(recmap(checkerboard(8)[sample(64,64),]))[4,]}))
 [1] 0.25 0.23 0.11 0.18 0.26 0.24 0.28 0.30 0.34 0.25

refactor colormaps in shiny application

library(colorspace)

list(colorspace_heat_hcl = heat_hcl(12, c = c(80, 30), l = c(30, 90), power = c(1/5, 2)),

use R version >= 3.6 - grDevices::hcl; grDevices::hcl.colors; grDevices::hcl.pals;

R> par(mfrow = c(2, 2))
R> pie(rep(1, 12), col = rainbow(12), main = "RGB/HSV")
R> pie(rep(1, 12), col = hcl.colors(12, "Set 2"), main = "HCL")

see also

C++ vignette

document how to use recmap as cmd executable.

#include <fstream>
#include <iostream>

#define PI 3.14159265358979323846
#include <recmap.h>

// eg++ -o recmapCmd recmap_main.cpp -std=c++11 -I ~/__checkouts/R/recmap/src/ -lm -pedantic -Wall -O2
// g++ -o recmapCmd recmap_main.cpp  -std=c++11 -I ~/__checkouts/R/recmap/src/ -lm -pedantic -Wall -O2
using namespace std;

int main()
{
    double x, y, dx, dy, z;
    string name;

    int count = 0;

    crecmap::RecMap X;

    while (!cin.eof()) {
    cout << "# " << X.get_size() << endl;
	cin >> x >> y >> dx >> dy >> z >> name;
	X.push_region(x, y, dx, dy, z, name);
	count++;
    }

    X.run(true);

    for (int i = 0; i < X.get_size(); i++) {
	crecmap::map_region r = X.get_map_region(i);
	cout << r.x << "\t" << r.y << "\t" << r.dx << "\t" << r.
	    dy << "\t" << r.name << "\t" << r.dfs_num << "\t" << r.
	    topology_error << "\t" << r.
	    relative_position_error << "\t" << r.
	    relative_position_neighborhood_error << endl;
    }
    cout << "# " << X.get_size() << endl;

    return 0;
}

recmapGRASP testcase solution vector differs due to change of default method for generating from a discrete uniform distribution


Received: from hornik by aragorn.wu.ac.at with local (Exim 4.92) (envelope-from <[email protected]>) id 1h1RAu-000056-0f; Wed, 06 Mar 2019 08:41:12 +0100
From: Kurt Hornik <[email protected]>
To: [email protected]
Subject: CRAN package recmap
Cc: [email protected]
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Reply-To: [email protected]
Message-Id: <[email protected]>
Date: Wed, 06 Mar 2019 08:41:12 +0100
Content-Transfer-Encoding: quoted-printable

Dear maintainer,

Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_recmap.html>.

The check problems with current R-devel are from

     =E2=80=A2 The default method for generating from a discrete uniform
       distribution (used in sample(), for instance) has been changed.
       ...
       The previous method can be requested using RNGkind() or
       RNGversion() if necessary for reproduction of old results.

To make your package successfully pass the checks for current R-devel
and R-release you may find it most convenient to insert

  suppressWarnings(RNGversion("3.5.0"))

before calling set.seed() in your example, vignette and test code (where
the difference in RNG sample kinds matters, of course).

Note that this ensures using the (old) non-uniform "Rounding" sampler
for all 3.x versions of R, and does not add an R version dependency.
Note also that the new "Rejection" sampler which R will use from 3.6.0
onwards by default is definitely preferable over the old one, so that
the above should really only be used as a temporary measure for
reproduction of the previous behavior (and the run time tests relying on
it).

Please correct before 2019-03-20 to safely retain your package on CRAN.

Best,
-k

screenshot 2019-03-06 at 14 46 46

recmap shiny application - Warning: Error in :: argument of length 0

> library(shiny)
> recmap_shiny <- system.file('shiny-examples', package = 'recmap')
> shiny::runApp(recmap_shiny, display.mode = 'normal')

Listening on http://127.0.0.1:6832
Loading required package: GA
Loading required package: foreach
Loading required package: iterators
  ____    _    
 / ___|  / \     Genetic 
| |  _  / _ \    Algorithms
| |_| |/ ___ \   
 \____/_/   \_\  version 3.1.1
Type 'citation("GA")' for citing this R package in publications.
Loading required package: Rcpp
Loading required package: sp
Package 'recmap' version 1.0.1
Warning: Error in :: argument of length 0
  133: combn
  131: checkerboard
  130: <reactive:Map> [/Library/Frameworks/R.framework/Versions/3.5/Resources/library/recmap/shiny-examples/server.R#131]
  114: Map
  113: <reactive:Cartogram> [/Library/Frameworks/R.framework/Versions/3.5/Resources/library/recmap/shiny-examples/server.R#168]
   97: Cartogram
   96: renderText [/Library/Frameworks/R.framework/Versions/3.5/Resources/library/recmap/shiny-examples/server.R#57]
   95: func
   82: origRenderFunc
   81: output$plot_hoverinfo
    1: shiny::runApp
Warning: Error in :: argument of length 0
  170: <Anonymous>
Warning: Error in :: argument of length 0
  170: <Anonymous>


one shiny application only

since we have the jss2711 data ...

  • combine all shiny application
  • have a radio button
    • checkerboard
    • US state
    • US county
    • Switzerland (Gemeinde level)

remove non-ASCII characters from jss2711.RData

* checking data for non-ASCII characters ... WARNING
  Warning: found non-ASCII strings
  'AltstC$tten SG' in object 'SBB'
  'Biel/Bienne BC6zingenfeld/Champ' in object 'SBB'
  'BossiC(re' in object 'SBB'
  'Boswil-BC<nzen' in object 'SBB'
  'BretonniC(res' in object 'SBB'
  'BrC<nig-Hasliberg' in object 'SBB'
  'Buchs-DC$llikon' in object 'SBB'
  'BC$ch' in object 'SBB'
  'BC4le' in object 'SBB'
  'BC<lach' in object 'SBB'
  'BC<rglen' in object 'SBB'
  'BC<tschwil' in object 'SBB'
  'ChambC)sy' in object 'SBB'
  'ChC"teauneuf-Conthey' in ob

Warning: Error in :: argument imply differing number of rows:1, 0

> runApp('inst/shiny-examples')

Listening on http://127.0.0.1:3354
Warning: Error in :: argument of length 0
  133: combn
  131: checkerboard
  130: <reactive:Map> [/Users/cp/__checkouts/R/recmap/inst/shiny-examples/server.R#142]
  114: Map
  113: <reactive:Cartogram> [/Users/cp/__checkouts/R/recmap/inst/shiny-examples/server.R#186]
   97: Cartogram
   96: renderText [/Users/cp/__checkouts/R/recmap/inst/shiny-examples/server.R#61]
   95: func
   82: origRenderFunc
   81: output$plot_hoverinfo
    1: runApp
Warning: Error in :: argument of length 0
  170: <Anonymous>
Warning: Error in :: argument of length 0
  170: <Anonymous>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.