Skip to content

Instantly share code, notes, and snippets.

@mkuhn
Created August 14, 2015 14:22
Show Gist options
  • Select an option

  • Save mkuhn/69bb73f98363c4fd1ff3 to your computer and use it in GitHub Desktop.

Select an option

Save mkuhn/69bb73f98363c4fd1ff3 to your computer and use it in GitHub Desktop.

Revisions

  1. mkuhn created this gist Aug 14, 2015.
    10 changes: 10 additions & 0 deletions code.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    library(dplyr)

    a <- data.frame(foo = 1:10, bar = "bar")
    b <- tbl_df(a)

    a[,1]
    b[,1]

    paste0(a[,1], "!")
    paste0(b[,1], "!")
    26 changes: 26 additions & 0 deletions output.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    > library(dplyr)
    >
    > a <- data.frame(foo = 1:10, bar = "bar")
    > b <- tbl_df(a)
    >
    > a[,1]
    [1] 1 2 3 4 5 6 7 8 9 10
    > b[,1]
    Source: local data frame [10 x 1]

    foo
    1 1
    2 2
    3 3
    4 4
    5 5
    6 6
    7 7
    8 8
    9 9
    10 10
    >
    > paste0(a[,1], "!")
    [1] "1!" "2!" "3!" "4!" "5!" "6!" "7!" "8!" "9!" "10!"
    > paste0(b[,1], "!")
    [1] "1:10!"