Skip to content

Instantly share code, notes, and snippets.

File.Size reading_function Object.Size Mem.Increase User.Time System.Time Elapsed.Time
1576105 magick::image_read 1049048 1050920 0.0170000000000528 0.00200000000000244 0.0264999999999418
1994600 magick::image_read 1327576 1329448 0.0194999999999936 0.00300000000000011 0.0309999999999491
2462383 magick::image_read 1638872 1640744 0.0244999999999891 0.00300000000000011 0.0400000000004184
2979319 magick::image_read 1982936 1984808 0.0294999999999845 0.00499999999999545 0.0474999999996726
3545586 magick::image_read 2359768 2361640 0.0364999999999895 0.00600000000000023 0.0559999999995853
4160985 magick::image_read 2769368 2771240 0.0399999999999636 0.00600000000000023 0.0619999999998981
4825702 magick::image_read 3211736 3213608 0.0475000000000136 0.007000000000005 0.0750000000007276
5539565 magick::image_read 3686872 3688744 0.0534999999999854 0.00800000000000267 0.0825000000004366
6302748 magick::image_read 4194776 4196648 0.0579999999999927 0.00900000000000745 0.090999999999439

Here's an interesting (at least to me) dataset for practicising regression analysis.

The data

First I installed ImageMagic (See ImageMagic documentation for installation on your OS). Then using ImageMagick's convert utility, I generated about 57 png files filled with random noise. The file dimensions go from 512px x 512px to 4096px x 4096px incrementing by 64 px in each direction.

mkdir -p ./data/RandomNoise
cd ./data/RandomNoise && \
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
global.colormap = require('/usr/local/lib/node_modules/colormap');
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"/usr/local/lib/node_modules/colormap":7}],2:[function(require,module,exports){
'use strict'
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
@bhaskarvk
bhaskarvk / getRConfig.sh
Last active September 8, 2016 22:27
Shell Script to get value of every R config flag.
getRConfig() {
echo " R CMD config $1"; R CMD config $1; echo "******************************************************************"; echo
}
(
getRConfig BLAS_LIBS
getRConfig CC
getRConfig CFLAGS
getRConfig CPICFLAGS
getRConfig CPP
getRConfig CPPFLAGS
window.google = window.google || {};
google.maps = google.maps || {};
(function() {
function getScript(src) {
document.write('<' + 'script src="' + src + '"><' + '/script>');
}
@bhaskarvk
bhaskarvk / README.md
Created September 9, 2016 14:17 — forked from jcheng5/README.md
Using arbitrary Leaflet plugins with Leaflet for R

Using arbitrary Leaflet JS plugins with Leaflet for R

The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.

If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.

library(leaflet)
library(htmltools)
library(htmlwidgets)
# Convert the JS and CSS from
# https://github.com/mapshakers/leaflet-icon-pulse/tree/master/src
# to proper URLs using rawgit.com
pluginDependency <- htmlDependency(
"leaflet-icon-pulse",version = "1.0",
library(shiny)
library(leaflet)
library(htmltools)
library(htmlwidgets)
ui <- bootstrapPage(
tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
leafletOutput("map", width = "100%", height = "100%")
)
R_BASEDIR=$HOME/Library/R/3.3
# Create 3 dirs in $R_BASEDIR library, library.github, library.cran
mkdir -p R_LIBS=$R_BASEDIR/library $R_BASEDIR/library.github $R_BASEDIR/library.cran
# Directory to log all output
mkdir -p $HOME/Library/Logs/R
export R_LIBS=$R_BASEDIR/library:$R_BASEDIR/library.github:$R_BASEDIR/library.cran
@bhaskarvk
bhaskarvk / with-gdal-1.x.txt
Last active October 28, 2016 14:55
Problems with rgdal::readOGR and int64
> library(rgdal)
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.5, released 2016/07/01
Path to GDAL shared files: /usr/local/Cellar/gdal/1.11.5_1/share/gdal
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-3
> spdf <- tigris::states()