GithubHelp home page GithubHelp logo

crochet's Introduction

crochet

CRAN_Status_Badge Number of direct and total dependencies Rdoc Travis-CI Build Status AppVeyor Build Status Coverage status

crochet is an R package that provides functions to help implement the extraction / subsetting / indexing function [ and replacement function [<- of custom matrix-like types (based on S3, S4, etc.), modeled as closely to the base matrix class as possible (with tests to prove it).

Example

Check out the Example of a Custom Type that Implements 'extract' and 'replace' vignette on the crochet page on CRAN.

Installation

Install the stable version from CRAN:

install.packages("crochet")

Alternatively, install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("agrueneberg/crochet")

Documentation

Further documentation can be found on RDocumentation.

Contributing

crochet's People

Contributors

agrueneberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crochet's Issues

Handle NA subsetting

Some cases that could be handled by crochet itself:

  • x[NA] for k
  • x[NA, ] for i
  • x[, NA] for j

I don't see any utility in developers implementing their own behavior for this case.

Detect ...

... needs to be counted againt nargs() to correctly detect index type.

Missing License File

Hi @agrueneberg

It would be helpful if the repository has a License File. It is showing as MIT expat in Description but it would be better if we had a clear Licence.md file

Test additional arguments

Find a way to optionally test additional arguments, for example by specifying a name (CROCHET_EXTRACT_ENV$OPTIONAL_ARG_NAME), value (CROCHET_EXTRACT_ENV$OPTIONAL_ARG_VALUE), and expected outcome (CROCHET_EXTRACT_ENV$OPTIONAL_ARG_TRANSFORMATION).

Convert integers to doubles if .Machine$integer.max is reached

> pryr::sexp_type(.Machine$integer.max)
[1] "INTSXP"
> G[.Machine$integer.max]
[1] -0.002505102
> .Machine$integer.max + 1L
[1] NA
> pryr::sexp_type(.Machine$integer.max + 1)
[1] "REALSXP"
> G[.Machine$integer.max + 1]
Error: cannot allocate vector of size 1250.6 Gb
In addition: Warning message:
In convertIndex(x, i, "k") : NAs introduced by coercion to integer range

Handle FALSE subsetting

Some cases that could be handled by crochet itself:

  • x[FALSE] for k
  • x[FALSE, ] for i
  • x[, FALSE] for j

I don't see any utility in developers implementing their own behavior for this case.

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.