mark

R package with a set of general use functions for easier working

https://github.com/jmbarbone/mark

Science Score: 26.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
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.8%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

R package with a set of general use functions for easier working

Basic Info
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • Open Issues: 29
  • Releases: 31
Created about 7 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

set.seed(42)
```

# mark


[![CRAN status](https://www.r-pkg.org/badges/version/mark)](https://CRAN.R-project.org/package=mark)
[![R-CMD-check](https://github.com/jmbarbone/mark/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jmbarbone/mark/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/jmbarbone/mark/graph/badge.svg)](https://app.codecov.io/gh/jmbarbone/mark)


Miscellaneous, Analytic R Kernels

An R package with a set of general use functions for data analytics.
This is developed mostly for personal use and has no real _goal_ other than to limit the time I spend searching where I did that thing that I think I could use again because it worked well but this problem might be slightly different and I know I had to change it before.

Some parts happily ripped from and (hopefully) credited to others.

## Installation

You can download the current CRAN version with:

```r
install.packages("mark")
```

You can the development version from [GitHub](https://github.com/jmbarbone/mark) with:

```r
remotes::install_github("jmbarbone/mark")
```

## Select examples

This package contains a many variety of functions, some useful, some not so much.
Below are a selection of a few functions that could potential be useful for others:

```{r library}
library(mark)
```

Get dates from sloppy entries:

```{r dates}
bad_dates <- c("2020 Dec 8th", "1970 May", "??", "1984 UNK UN")
date_from_partial(bad_dates)
date_from_partial(bad_dates, method = "max")
date_from_partial(c("May 2000", "08Dec2020"), format = "dmy")
```

Slice strings:

```{r strings}
x <- stringi::stri_rand_lipsum(1)
str_slice(x, n = 50L)
str_slice_by_word(x)
```

Read in bibliographies:

```{r bibs}
file <- system.file("extdata", "example-bib.txt", package = "mark")
bib <- read_bib(file)
tibble::as_tibble(bib)
```

More matching:

```{r matching}
1:10 %out% c(1, 3, 5, 9) # opposite of %in% 
letters[1:5] %wo% letters[3:7]
letters[1:5] %wi% letters[3:7]
```

Small functions for working with data.frames:

```{r dataframes}
x <- list(a = 1:5, b = letters[1:5])
quick_df(x)

vector2df(x[["b"]], name = NULL)

quick_dfl(a = 1:3, b = list(1:5, 6:10, 11:15))
```

Counts and proportions:

```{r counts}
set.seed(42)
x <- sample(1:5, 20, TRUE, 5:1/2)
counts(x)
props(x)

df <- as.data.frame(matrix(sample(1:2, 60, TRUE), byrow = TRUE, ncol = 3))
counts(df, c("V1", "V2"))
props(df, 1:3)
```

Date time differences:

```{r diff_time}
x <- as.POSIXlt("2021-02-13 05:02:30", tz = "America/New_York") + c(0, -1, 2) * 3600 * 24
y <- as.POSIXlt("2020-02-13 05:02:30", tz = "America/New_York") + c(0, -2, 4) * 3600 * 24

# comparison with base::difftime() (note the order of x and y)
difftime(y, x, units = "days")
diff_time_days(x, y)

difftime(y, x, units = "secs")
diff_time_secs(x, y)

# Year (by days, months, etc)
diff_time_years(x, y)
diff_time_myears(x, y)

# Set time zones
diff_time_hours(x, y, "GMT", "America/New_York")                         
diff_time_hours(x, x, "GMT", c("America/Los_Angeles", "America/New_York", "Europe/London")) # note x, x
diff_time_days(x, y, NULL, 31536000) 
```

Simple factors:

```{r}
fact(c("a", "c", NA, "a", "b", NA, "a", "c")) # no sorting
fact(c(-1, 5, 2, NA, 3))                      # sorting
fact(c(NA, FALSE, TRUE, FALSE, TRUE, NA))     # fixed
```

Owner

  • Name: Jordan Mark Barbone
  • Login: jmbarbone
  • Kind: user
  • Location: Greater Philadelphia
  • Company: @cogstate-dev

Clinical Data Scientist who likes using R

GitHub Events

Total
  • Create event: 12
  • Release event: 5
  • Issues event: 14
  • Watch event: 1
  • Delete event: 6
  • Push event: 61
  • Pull request event: 14
Last Year
  • Create event: 12
  • Release event: 5
  • Issues event: 14
  • Watch event: 1
  • Delete event: 6
  • Push event: 61
  • Pull request event: 14

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 1,119
  • Total Committers: 5
  • Avg Commits per committer: 223.8
  • Development Distribution Score (DDS): 0.199
Past Year
  • Commits: 190
  • Committers: 2
  • Avg Commits per committer: 95.0
  • Development Distribution Score (DDS): 0.005
Top Committers
Name Email Commits
jmbarbone j****e@g****m 896
Jordan Mark Barbone 3****e 211
Jordan Mark Barbone j****e@c****m 7
jordan.barbone j****e@b****m 4
Hadley Wickham h****m@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 103
  • Total pull requests: 75
  • Average time to close issues: 5 months
  • Average time to close pull requests: 12 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.18
  • Average comments per pull request: 0.03
  • Merged pull requests: 71
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 9
  • Pull requests: 18
  • Average time to close issues: 7 days
  • Average time to close pull requests: 12 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 18
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jmbarbone (103)
Pull Request Authors
  • jmbarbone (73)
  • hadley (1)
  • olivroy (1)
Top Labels
Issue Labels
:gem: enhancement (14) enhancement :gem: (14) :bug: bug (12) easier :rabbit2: (11) open to prs :door: (10) :id: fact() (9) :rabbit2: easier (8) bug :bug: (7) new feature :gift: (7) :wrench: internal (6) :gift: new feature (6) :pencil2: documentation (5) documentation :pencil2: (4) :exclamation: URGENT (4) :otter: cran (4) help wanted :white_flag: (2) cran :otter: (2) :gemini: duplicate (1) :white_flag: help wanted (1) internal :wrench: (1)
Pull Request Labels
:id: fact() (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 542 last-month
  • Total docker downloads: 2,068
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 17
  • Total maintainers: 1
cran.r-project.org: mark

Miscellaneous, Analytic R Kernels

  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 542 Last month
  • Docker Downloads: 2,068
Rankings
Docker downloads count: 15.9%
Forks count: 17.0%
Dependent repos count: 19.2%
Stargazers count: 19.3%
Average: 20.2%
Downloads: 21.0%
Dependent packages count: 28.7%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/continuous-benchmarks.yaml actions
  • actions/checkout master composite
  • r-lib/actions/setup-r master composite
.github/workflows/lint.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.6 depends
  • magrittr >= 2.0.1 imports
  • stats >= 3.6 imports
  • tools >= 3.6 imports
  • utils >= 3.6 imports
  • bench >= 1.1.1 suggests
  • bib2df >= 1.1.1 suggests
  • covr >= 3.5.1 suggests
  • crayon >= 1.3.4 suggests
  • desc >= 1.3.0 suggests
  • dplyr >= 1.0.6 suggests
  • graphics >= 3.6 suggests
  • haven * suggests
  • knitr >= 1.30 suggests
  • rcmdcheck >= 1.3.3 suggests
  • spelling >= 2.2 suggests
  • stringi >= 1.5.3 suggests
  • testthat >= 3.0.0 suggests
  • tibble >= 3.0.4 suggests
  • waldo >= 0.2.5 suggests
  • withr >= 2.3.0 suggests
tests/testthat/files/DESCRIPTION cran
  • R >= 3.6 depends
.github/workflows/r-check-version.yaml actions
  • actions/checkout v3 composite
  • jmbarbone/actions/r-check-version main composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite