cellranger

Helper functions to work with spreadsheets and the "A1:D10" style of cell range specification

https://github.com/rsheets/cellranger

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary

Keywords from Contributors

parsing fwf csv xlsx xls spreadsheet setup unit-testing excel curl
Last synced: 6 months ago · JSON representation

Repository

Helper functions to work with spreadsheets and the "A1:D10" style of cell range specification

Basic Info
  • Host: GitHub
  • Owner: rsheets
  • License: other
  • Language: R
  • Default Branch: main
  • Size: 813 KB
Statistics
  • Stars: 51
  • Watchers: 5
  • Forks: 6
  • Open Issues: 21
  • Releases: 4
Created almost 11 years ago · Last pushed about 3 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



[![TravisCI Build Status](https://travis-ci.org/rsheets/cellranger.svg?branch=master)](https://travis-ci.org/rsheets/cellranger)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/rsheets/cellranger?branch=master&svg=true)](https://ci.appveyor.com/project/rsheets/cellranger)
[![codecov.io](https://codecov.io/github/rsheets/cellranger/coverage.svg?branch=master)](https://codecov.io/github/rsheets/cellranger?branch=master) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21970.svg)](http://dx.doi.org/10.5281/zenodo.21970)
[![CRAN version](http://www.r-pkg.org/badges/version/cellranger)](https://cran.r-project.org/package=cellranger)
![](http://cranlogs.r-pkg.org/badges/grand-total/cellranger)



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
```

Helper package to support R scripts or packages that interact with spreadsheets.

### Installation

Option 1: Install from CRAN:

```{r eval = FALSE}
install.packages("cellranger")
```

Option 2: Install the development version from GitHub:

```{r eval = FALSE}
# install.packages("devtools")
devtools::install_github("jennybc/cellranger")
```

### What is `cellranger` for?

**Describe a rectangle of cells**. For example, what you've got is the string "D12:F15" and what you want is an R object that holds the row and column for the upper left and lower right corners of this rectangle. Read below about the `cell_limits` class. The [`googlesheets`](https://github.com/jennybc/googlesheets) and [`readODS`](https://github.com/chainsawriot/readODS) packages use `cellranger` to translate user-supplied cell range info into something more programmatically useful.

**Handle cell references found in spreadsheet formulas**. If you're parsing unevaluated spreadsheet formulas, use the `ra_ref` and `cell_addr` classes for handling absolute, relative, and mixed cell references. Classes inspired by [Spreadsheet Implementation Technology](https://mitpress.mit.edu/books/spreadsheet-implementation-technology) from Sestoft (MIT Press, 2014).

**Convert between annoying spreadsheet reference formats**. Some utility functions are exposed, such as `A1_to_R1C1()`, which converts from A1 formatted strings to R1C1, and `letter_to_num()`, which converts a Excel column ID to a number, e.g. column AQZ is more usefully known as column 1144.

### Describing rectangles via `cell_limits`

`cellranger` provides an S3 class, `cell_limits`, as the standard way to store a cell range. You can explicitly construct a `cell_limits` object by specifying the upper left and lower right cells and, optionally, the hosting worksheet:

```{r eval = FALSE}
cell_limits(ul = c(ROW_MIN, COL_MIN), lr = c(ROW_MAX, COL_MAX), sheet = "SHEET")
```

Think of it like `R3C1:R7C4` notation, but with the `R` and `C` removed.

More often you'll get a `cell_limits` object by sending diverse user input through `as.cell_limits()`. That's what's going on in calls like these from [`googlesheets`](https://github.com/jennybc/googlesheets):

```{r eval = FALSE}
library(googlesheets)
gs_read(..., range = "D12:F15")
gs_read(..., range = "raw_data!R1C12:R6C15")
gs_read(..., range = cell_limits(c(1, 1), c(6, 15)))
gs_read(..., range = cell_limits(c(2, 1), c(NA, NA)))
gs_read(..., range = cell_rows(1:100))
gs_read(..., range = cell_cols(3:8))
gs_read(..., range = cell_cols("B:MZ"))
gs_read(..., range = anchored("B4", dim = c(2, 10)))
gs_read(..., range = anchored("A1", dim = c(5, 6), col_names = TRUE))
## internal usage in functions that put data into a googlesheet
anchored(input = head(iris))
anchored(input = head(iris), col_names = FALSE)
anchored(input = head(LETTERS))
anchored(input = head(LETTERS), byrow = TRUE)
```

Read the docs for more information on some specialized helpers:

  * Row- or column-only specification: `cell_rows()`, `cell_cols()`.
  * Specification via an object you want to write and, optionally, an anchor cell: `anchored()`

```{r}
library("cellranger")
(cl <- as.cell_limits("raw_data!R1C12:R6C15"))
```

The `dim` method reports dimensions of the targetted cell rectangle. `as.range()` converts a `cell_limits` object back into an Excel range.

```{r}
dim(cl)

as.range(cl)

as.range(cl, fo = "A1", sheet = FALSE, strict = TRUE)
```

Use `NA` to leave a limit unspecified, i.e. describe a degenerate rectangle

```{r}
cell_limits(c(3, 2), c(7, NA))
```

If the maximum row or column is specified but the associated minimum is not, then it is set to 1.

```{r}
cell_limits(c(NA, NA), c(3, 5))
```

### Utilities for spreadsheet annoyances

We've exposed utility functions which could be useful to anyone manipulating Excel-like references.

```{r}
## convert character column IDs to numbers ... and vice versa
letter_to_num(c('AA', 'ZZ', 'ABD', 'ZZZ', ''))

num_to_letter(c(27, 702, 732, 18278, 0, -5))

## convert between A1 and R1C1 cell references
A1_to_R1C1(c("$A$1", "$AZ$10"))
A1_to_R1C1(c("A1", "AZ10"), strict = FALSE)

R1C1_to_A1(c("R1C1", "R10C52"))
R1C1_to_A1(c("R1C1", "R10C52"), strict = FALSE)

## detect cell reference formats with
## is_A1() and is_R1C1()
x <- c("A1", "$A4", "$b$12", "RC1", "R[-4]C9", "R5C3")
data.frame(x, A1 = is_A1(x), R1C1 = is_R1C1(x))

## guess format with
## guess_fo()
refs <- c("A1", "$A1", "A$1", "$A$1", "a1",
          "R1C1", "R1C[-1]", "R[-1]C1", "R[-1]C[9]")
data.frame(refs, guessed = guess_fo(refs))
```

Owner

  • Name: rsheets
  • Login: rsheets
  • Kind: organization

GitHub Events

Total
Last Year

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 140
  • Total Committers: 4
  • Avg Commits per committer: 35.0
  • Development Distribution Score (DDS): 0.143
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
jennybc j****y@s****a 120
Jenny Bryan j****n@g****m 13
hadley h****m@g****m 6
nacnudus n****s@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 38
  • Total pull requests: 3
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 14
  • Total pull request authors: 3
  • Average comments per issue: 1.39
  • Average comments per pull request: 1.33
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jennybc (23)
  • richfitz (2)
  • hadley (2)
  • assadde (1)
  • alephreish (1)
  • StevenMMortimer (1)
  • zx8754 (1)
  • vjcitn (1)
  • yanglq-bio (1)
  • Droelf-source (1)
  • michaelquinn32 (1)
  • jjcad (1)
  • r2evans (1)
  • StatisMike (1)
Pull Request Authors
  • jennybc (1)
  • hadley (1)
  • nacnudus (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 473,252 last-month
  • Total docker downloads: 45,933,341
  • Total dependent packages: 15
    (may contain duplicates)
  • Total dependent repositories: 86
    (may contain duplicates)
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: cellranger

Translate Spreadsheet Cell Ranges to Rows and Columns

  • Versions: 3
  • Dependent Packages: 10
  • Dependent Repositories: 46
  • Downloads: 473,252 Last month
  • Docker Downloads: 45,933,341
Rankings
Downloads: 0.5%
Dependent repos count: 3.6%
Dependent packages count: 5.3%
Stargazers count: 7.0%
Average: 7.2%
Forks count: 9.8%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 7 months ago
conda-forge.org: r-cellranger
  • Versions: 1
  • Dependent Packages: 5
  • Dependent Repositories: 40
Rankings
Dependent repos count: 5.7%
Dependent packages count: 10.4%
Average: 27.3%
Stargazers count: 41.0%
Forks count: 52.2%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.1 depends
  • rematch * imports
  • rematch2 * imports
  • tibble * imports
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 1.0.0 suggests