Skip to content

Instantly share code, notes, and snippets.

# load libraries
library(ggplot2)
library(plyr)
library(reshape2)
# function to calculate monthly payments
paymnth=function(loanamt,irate,nyr,xtraprin,xtraprintime){
# Calculate monthly payments
@rdabbler
rdabbler / carsearch.R
Created August 25, 2013 03:02
R for car search
#
# Get appraised value of car from Edmunds.com using the developer API with R
# Reference: http://developer.edmunds.com/docs/read/The_Vehicle_API
#
# set working dir
setwd('~/R/carvalue')
#load libraries
library(RJSONIO)
@rdabbler
rdabbler / projects.csv
Last active December 10, 2015 10:58
Shiny App to Test User Input Forms (Using actionButtons)
pid project duedt stage updttime
1 Proj1 2013-12-01 Stg0 2012-12-20 18:50:00
2 Proj2 2013-06-01 Stg2 2012-12-20 18:50:00
3 Proj3 2014-03-01 Stg0 2012-12-20 18:50:00
4 Proj4 2015-08-01 Stg1 2012-12-20 18:50:00
5 Proj5 2013-12-01 Stg1 2012-12-20 18:50:00
@rdabbler
rdabbler / server.R
Last active December 10, 2015 08:58
Shiny App to Test User Input with a Form
library(shiny)
# load a very small projects file
# Eventually the idea is to have a database link to SQLite or access
projects=data.frame(pid=c(1,2,3,4,5),project=c("proj1","proj2","proj3","proj4","proj5"))
# Define server logic
shinyServer(function(input, output) {
# if Projects -> View Projects is selected, this outputs the lists in dataframe projects
@rdabbler
rdabbler / instructR.R
Created December 8, 2012 16:52
Code for shiny app: testInteractiveR
# Here a set of instructions corresponding to each code lesson is made into a dataset codelist
ID=as.numeric() # id of code lesson
instruct=as.character() # instructions for code lesson
subhead=as.character() # subheading for code lesson
i=1
ID[i]=i
subhead[i]="Simple R Expressions: Addition"
instruct[i]=paste('Try simple math','Type the command below','','1+1','',sep="\n")