Skip to content

Instantly share code, notes, and snippets.

View pedrokarneiro's full-sized avatar
💼
Contact me via LinkedIn

Pedro Carneiro Jr. pedrokarneiro

💼
Contact me via LinkedIn
View GitHub Profile
# Day 0: Mean, Median, and Mode
# Selecting standard input
con <- file('stdin', open='r')
# We don't need the first input
data_line <- readLines(con)[[2]]
# splitting the data into individual string
split_data <- strsplit(data_line, " ")
@jcheng5
jcheng5 / app.R
Last active September 29, 2017 14:49
leaflet raster example
# Prerequisites:
# devtools::install_github("jcheng5/rasterfaster")
# devtools::install_github("rstudio/leaflet@raster")
library(shiny)
library(leaflet)
showRaster <- function(r, defaultTiles = TRUE, colorFunc = colorBin("RdBu", c(minValue(r), maxValue(r)), 8)) {
if (!inherits(r, "RasterLayer")) {
stop("showRaster only works with raster layers")
@javierarilos
javierarilos / micro-mongodb-python-book.py
Created May 22, 2014 21:47
The Little MongoDB Book code examples written in Python + pymongo
##########################################################################
# THE MICRO MONGODB+PYTHON BOOK
#
# A simple adaptation to Python + summary of
# The Little MongoDB Book: https://github.com/karlseguin/the-little-mongodb-book
#
# javier arias losada
# twitter: @javier_arilos
# Usage suggestion: run line by line bu using pydemo project (https://github.com/pablito56/pydemo)
@wch
wch / DESCRIPTION
Last active January 21, 2022 14:25
Dynamic UI example app for R Shiny
Type: Shiny
Title: Dynamic UI
License: MIT
Author: Winston Chang <[email protected]>
AuthorUrl: http://www.rstudio.com/
Tags: dynamic-ui renderui uioutput
DisplayMode: Showcase
data_sets <- c("mtcars")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# select a car