itsleeds / pct

Get and reproduce data from the Propensity to Cycle Tool (PCT)
https://itsleeds.github.io/pct/
19 stars 10 forks source link

PCT is currently failing CRAN tests and will be removed unless it is fixed #81

Closed Robinlovelace closed 3 years ago

Robinlovelace commented 3 years ago

See here: https://cran.r-project.org/web/checks/check_results_pct.html

Key bit:


    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: uptake_pct_godutch
    > ### Title: Calculate cycling uptake for UK 'Go Dutch' scenario
    > ### Aliases: uptake_pct_godutch
    >
    > ### ** Examples
    >
    > # https://www.jtlu.org/index.php/jtlu/article/download/862/1381/4359
    > # Equation 1B:
    > distance = 15
    > gradient = 2
    > logit = -3.959 + 2.523 +
    + ((-0.5963 - 0.07626) * distance) +
    + (1.866 * sqrt(distance)) +
    + (0.008050 * distance^2) +
    + (-0.2710 * gradient) +
    + (0.009394 * distance*gradient) +
    + (-0.05135 * sqrt(distance) *gradient)
    > logit
    [1] -3.144098
    > # Result: -3.144098
    >
    > pcycle = exp(logit) / (1 + exp(logit))
    > # Result: 0.04132445
    > boot::inv.logit(logit)
    [1] 0.04132445
    > uptake_pct_godutch(distance, gradient, alpha = -3.959 + 2.523, d1 = -0.5963 - 0.07626,
    + d2 = 1.866, d3 = 0.008050, h1 = -0.2710, i1 = 0.009394, i2 = -0.05135
    + )
    Error in exists(c("distance", "gradient")) :
     first argument has length > 1
    Calls: uptake_pct_godutch -> exists
    Execution halted 

Could be a good challenge if you fancy one @ccamara.