Giter Club home page Giter Club logo

rawr's Introduction

rawr

CRAN status Travis build status

rawr helps you quickly grab R code from the web, either straight to an R file, or to your clipboard. This avoids tedious copy/pasting of code from browser to IDE.

R Code from Popular R websites

Retrieve R code from a website to your clipboard with rawr_to_clip(), here are some examples:

# install.packages("rawr")
library(rawr)

# CRAN vignettes
rawr_to_clip("https://cran.r-project.org/web/packages/tidytext/vignettes/tidytext.html")

# Stack Overflow
rawr_to_clip("https://stackoverflow.com/questions/58248102/date-input-dt-r-shiny")

# Kaggle
rawr_to_clip("https://www.kaggle.com/vrtjso/mercari-eda-more-info-than-you-can-imagine")

# GitHub 
rawr_to_clip("https://github.com/hadley/vis-eda/blob/master/travel.R")

# Jupyter Notebook on GitHub
rawr_to_clip("https://github.com/tulip-lab/sit742/blob/master/Jupyter/SIT742P10B-MLSystem.ipynb")

# Blogdown sites
rawr_to_clip("https://www.jtimm.net/2019/04/14/lexical-change-procrustes/")

Other functionality

Write output to a temp file

rawr("https://www.kaggle.com/vrtjso/mercari-eda-more-info-than-you-can-imagine", to_file=T)

Write output to a specific file

rawr("https://www.kaggle.com/vrtjso/mercari-eda-more-info-than-you-can-imagine", file_path="mynewfile.R")

Issues and Feature Requests

When reporting an issue, please include:

  • Example code that reproduces the observed behavior.
  • An explanation of what the expected behavior is.
  • A specific url you’re attempting to retrieve R code from (if that’s what your issue concerns)

For feature requests, raise an issue with the following:

  • The desired functionality
  • Example inputs and desired output

Pull Requests

Pull requests are welcomed. Before doing so, please create an issue or email me with your idea.

Any new functions should follow the conventions established by the the package’s existing functions. Please ensure

  • Functions are sensibly named
  • The intent of the contribution is clear
  • At least one example is provided in the documentation

rawr's People

Contributors

stevecondylios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rawr's Issues

Option to prepend source URL to `rawr()` output

It could be useful to automatically include the source URL in rawr() output, such that

rawr("https://www.kaggle.com/vrtjso/mercari-eda-more-info-than-you-can-imagine", 
  to_file=T, 
  source = T)

Would return

# From: https://www.kaggle.com/vrtjso/mercari-eda-more-info-than-you-can-imagine

library(data.table) # Loading data
library(ggplot2) # Data visualization
library(treemapify) # Treemap visualization
etc

Note the extra lines at the top of the output

stackoverflow() to intelligently recognise answer urls

Stack Overflow allows users to link to a specific answer. stackoverflow() should recognise when a url is referring to a specific answer and return only code for that answer.

Lower priority: the same can be applied to urls for comments.

List of checksum-verified example urls, organised by topic

rawr expedites the transfer of R code from web to interpreter which is great for beginners and more experienced programmers alike.

A list of compatible urls, organised by topic, as well as a way of browsing/searching these urls, would be an excellent addition.

The urls would be 'best in class' tutorials and demonstrations, thus improving the speed with which R users can learn a new topic, and relieve any complications arising from those sources being in unstandardised formats (i.e. rawr takes care of differences across websites).

If required, checksums could be used to ensure the extracted code is unaltered from the time the url was added to the list. I have not found a way to validate externally read files (e.g. S3 or Cloud Storage) yet, but that could also be useful.

Alias for rawr_to_clip

r2c() and/or rtc() seem sensible aliases for convenient use of rawr_to_clip()

CRAN_collisions("r2c")
$packages
character(0)

$functions
[1] package_names  function_names
<0 rows> (or 0-length row.names)

CRAN_collisions("rtc")
$packages
character(0)

$functions
[1] package_names  function_names
<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.