GithubHelp home page GithubHelp logo

pegeler / eddington2 Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 2.0 858 KB

Calculating your Eddington Number for Cycling ๐Ÿšฒ๐Ÿ“ˆ

Home Page: https://eddington.bike

License: GNU General Public License v3.0

R 36.14% C++ 28.75% C 9.54% Makefile 0.74% PHP 0.40% Python 10.54% Shell 0.43% Fortran 1.67% Awk 0.22% SAS 0.24% APL 0.08% Julia 1.17% VBA 0.63% Java 0.89% Scala 6.03% Perl 0.54% Rust 2.00%
cycling eddington r-package vba-excel eddington-number algorithm calculation h-index

eddington2's Introduction

profile stats top languages

Disclaimer

Comments and posts on this site are my own and do not necessarily reflect the views of my employer or any organization of which I am a member.

eddington2's People

Contributors

pegeler avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kampfsca meisterp

eddington2's Issues

Why R >=4.3?

The minimum R >=4.3.0 is unusual. Why is it necessary?

R6 Eddington class cannot be saved without data loss.

The hash map of ride history is just a pointer (Rcpp::XPtr) to a std::unordered_map. So if a user attempts to save the Eddington class using save() or saveRDS(), they will be disappointed when reloading data since the pointer will be nil and the data will be lost.

This means that in current-state, several functions will not work as intended when attempting to manipulate the same object between sessions. Some will error silently (like the update() method) and others will raise an error (like attempting to access the H active field).

Clone method in R6 Eddington class causes undesired behavior

Using the clone() or clone(deep = TRUE) method will result in the internal hashmap pointing to the same memory address. Therefore, changes made to any of these objects will propagate to others.

# Random data
rides <- rgamma(15, shape = 2, scale = 10)

# Make shallow and deep clones
e <- Eddington$new(rides)
e$H
##   ride_length ride_count
## 1          11          1
## 2          12          2
## 3          13          1
## 4          16          2
## 5          19          1
## 6          36          1
## 7          37          1
## 8          47          1

foo <- e$clone()
bar <- e$clone(TRUE)

# See that the pointer for each hashmap is the same
e$.__enclos_env__$private$.H
## <pointer: 0x0123456789ab>
foo$.__enclos_env__$private$.H
## <pointer: 0x0123456789ab>
bar$.__enclos_env__$private$.H
## <pointer: 0x0123456789ab>

# Update data in 'e' ONLY
e$update(rep(50,50))

# Hashmap has been updated for clones as well
e$H
## [1] ride_length ride_count 
## <0 rows> (or 0-length row.names)
foo$H
## [1] ride_length ride_count 
## <0 rows> (or 0-length row.names)
bar$H
## [1] ride_length ride_count 
## <0 rows> (or 0-length row.names)

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.