Read Clipboard as Tribble
read_cb_trbl(header = TRUE, quote = "\"")
header | True if data has a header. |
---|---|
quote | Single character used to quote strings. |
Other clipboard functions:
copy_cb()
,
copy_to_clipboard()
,
read_cb_hl()
,
read_cb()
,
read_clipboard()
library(tidyverse) # Test Data test_data <- tibble(A = 1:3, B = c("Apples", "Bananas", "Oranges"), C = factor(c("Apples", "Bananas", "Oranges")), D = runif(3)) # Copy to Clipboard copy_cb(data = test_data) # Read Clipboard read_cb()#> A B C D #> 1 1 Apples Apples 0.7725215 #> 2 2 Bananas Bananas 0.8746007 #> 3 3 Oranges Oranges 0.1749406#> A B C D #> "integer" "character" "factor" "numeric"sapply(read_cb(), FUN = class) # `read_cb()` function mutates all factors to character before returning#> A B C D #> "integer" "character" "character" "numeric"#> V1 V2 V3 V4 #> 1 A B C D #> 2 1 Apples Apples 0.772521511185914 #> 3 2 Bananas Bananas 0.874600660754368 #> 4 3 Oranges Oranges 0.174940626835451# Read Clipboard as a Tribble for Copy and Paste read_cb_trbl()#> tibble::tribble(, #> ~A,~B,~C,~D, #> 1, "Apples", "Apples", 0.772521511185914, #> 2, "Bananas", "Bananas", 0.874600660754368, #> 3, "Oranges", "Oranges", 0.174940626835451, #> )read_cb_trbl(header = FALSE)#> tibble::tribble(, #> ~V1,~V2,~V3,~V4, #> "A", "B", "C", "D", #> "1", "Apples", "Apples", "0.772521511185914", #> "2", "Bananas", "Bananas", "0.874600660754368", #> "3", "Oranges", "Oranges", "0.174940626835451", #> )read_cb_trbl(quote = "'")#> tibble::tribble(, #> ~A,~B,~C,~D, #> 1, 'Apples', 'Apples', 0.772521511185914, #> 2, 'Bananas', 'Bananas', 0.874600660754368, #> 3, 'Oranges', 'Oranges', 0.174940626835451, #> )read_cb_trbl(header = FALSE, quote = "'")#> tibble::tribble(, #> ~V1,~V2,~V3,~V4, #> 'A', 'B', 'C', 'D', #> '1', 'Apples', 'Apples', '0.772521511185914', #> '2', 'Bananas', 'Bananas', '0.874600660754368', #> '3', 'Oranges', 'Oranges', '0.174940626835451', #> )