library(tidyverse)
#> + ggplot2 2.2.1.9000 Date: 2017-05-20
#> + tibble 1.3.1 R: 3.4.0
#> + tidyr 0.6.3 OS: elementary OS 0.4.1 Loki
#> + readr 1.1.1 GUI: X11
#> + purrr 0.2.2.2 Locale: en_US.UTF-8
#> + dplyr 0.5.0.9005 TZ: posixrules
#> + stringr 1.2.0
#> + forcats 0.2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.*; | |
import java.util.concurrent.atomic.*; | |
class StringToIntConversion { | |
public static void main(String[] args) { | |
String binary = "01110"; | |
System.out.println(Integer.valueOf(binary, 2)); | |
System.out.println(toRadix(binary, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.stream.*; | |
class CountingOccureences { | |
public static void main(String[] args) { | |
String example = "The quick brown fox jumps over the lazy dog and the dog catches the fox"; | |
System.out.println(countOccurences(example.replaceAll("\\s", ""), "")); | |
// output: {a=3, b=1, c=3, d=3, e=6, f=2, g=2, h=5, i=1, j=1, k=1, l=1, m=1, n=2, o=6, p=1, q=1, r=2, s=2, t=5, u=2, v=1, w=1, x=2, y=1, z=1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
public static class ExtnesionMethods { | |
public static IEnumerable<T> MaxOverPrevious<T, S>(this IEnumerable<T> enumerable, Func<T, S> comparable) where S : IComparable<S> | |
{ | |
if (!enumerable.Any()) yield break; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getPackages <- function(packs){ | |
packages <- unlist( | |
tools::package_dependencies(packs, available.packages(), | |
which=c("Depends", "Imports"), recursive=TRUE) | |
) | |
packages <- union(packs, packages) | |
packages | |
} | |
packages <- getPackages(c("ggplot2", "MASS")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Replace categorical x-axis labels with images | |
#' | |
#' Pipe a ggplot2 graph (with categorical x-axis) into this function with the argument of a list of | |
#' pictures (e.g. loaded via readImage) and it builds a new grob with the x-axis categories | |
#' now labelled by the images. Solves a problem that you perhaps shouldn't have. | |
#' | |
#' @author J. Carroll, \email{jono@@jcarroll.com.au} | |
#' @references \url{http://stackoverflow.com/questions/29939447/icons-as-x-axis-labels-in-r-ggplot2} | |
#' | |
#' @param g ggplot graph with categorical x axis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rvest) | |
library(lubridate) | |
library(ggalt) | |
obama_url <- "http://www.rasmussenreports.com/public_content/politics/obama_administration/obama_approval_index_history" | |
trump_url <- "http://www.rasmussenreports.com/public_content/politics/trump_administration/trump_approval_index_history" | |
index <- list(obama = obama_url, trump = trump_url) %>% | |
map_df(~ read_html(.x) %>% |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(R.utils) | |
library(glue) | |
library(padr) | |
library(ggExtra) | |
library(lubridate) | |
library(scales) | |
library(hrbrthemes) | |
#london |
I hereby claim:
- I am yeedle on github.
- I am yeedle (https://keybase.io/yeedle) on keybase.
- I have a public key ASAAPQHuf4Regji3HsrhtW0tKbOSvMjHlV1lSpxv6zbvPAo
To claim this, I am signing this object:
OlderNewer