Code Monkey home page Code Monkey logo

appify's Introduction

appify

Write R Get Apps!

Have you ever wished that creating an app was as easy as calling a function? Now it is!

  1. Write an R function,
  2. pass it to appify,
  3. specify the inputs.

Done. There is your app!

Usage

appify is meant to be used with OpenCPU. Include an Rmarkdown document or website in your R-package. Set the output directory in yaml to ../inst/www/. Inlcude an R script in your package's R directory with a command like this rmarkdown::render_site(input = "_app/") assuming you've put the files for your rmarkdown website in _app/. Templates will become available soon. Check the demo for a working example.

Install

install.packages("opencpu")
install.packages("devtools")
devtools::install_github("retowyss/appify")

Demo

Have a look at the template package on Github retowyss/appify-demo, clone it, build it and run it with OpenCPU.

opencpu::ocpu_start_app("appify-demo")

Example

Load the package.

require(appify)

Write your R function.


iris_clustering <- function(color_1, color_2, color_3) {
  require(ggplot2)
  clusters <- kmeans(iris[, 1:4], centers = 3, nstart = 3)
  
  iris_clustered <- cbind(iris, clusters = factor(clusters$cluster))
  
  ggplot(iris_clustered, aes(x = Sepal.Width, y = Petal.Width, color = clusters)) +
    geom_point() +
    scale_color_manual(values = c(color_1, color_2, color_3)) +
    ggtitle("Kmeans Clustering") + 
    theme_minimal()
}

appify has only one top level function appify. The function requires two inputs:

  1. a function f and
  2. a list inputs.

That's it.

appify(
  f = iris_clustering, 
  inputs = list(
    color_1 = dropdown_color("Color 1"),
    color_2 = dropdown_color("Color 2"),
    color_3 = dropdown_color("Color 3")
  )
)

appify's People

Contributors

freakypenguin avatar retowyss avatar

Watchers

 avatar  avatar

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.