Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hughjonesd/codesamples

R Code Samples From Various Sources
https://github.com/hughjonesd/codesamples

Last synced: 4 days ago
JSON representation

R Code Samples From Various Sources

Awesome Lists containing this project

README

        

---
output: github_document
---

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

# codesamples

A large database of R snippets from Stack Overflow, Github and
package examples.

## Installation

You can install the development version of codesamples from [GitHub](https://github.com/) with:

``` r
# install.packages("remotes")
remotes::install_github("hughjonesd/codesamples")
```

## Example

```{r}
library(codesamples)
dim(github_data)
dim(so_questions)
dim(package_examples)

first_lines <- strsplit(github_data$snippet[[1]], "\n")[[1]][1:23]
cat(first_lines, sep = "\n")

cat(package_examples$snippet[[1]])

cat(so_questions$snippet[[1]])

```