-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow space as a separator #76
base: master
Are you sure you want to change the base?
Allow space as a separator #76
Conversation
suitable test file closes MilesMcBain#61
I tested this with a random example off of StackOverflow and it uncovered a couple of bugs in my implementation - firstly, multiple spaces may be used as a separator. Secondly, if the SO content is pasted in from R then it may have rownames, in which case there will be no column header. I have pushed a fix which accounts for both of these, and creates a quoted Example: chr genome region
1 chr1 hg19_refGene CDS
2 chr1 hg19_refGene exon
3 chr1 hg19_refGene CDS
4 chr1 hg19_refGene exon
5 chr1 hg19_refGene CDS
6 chr1 hg19_refGene exon
data.frame(stringsAsFactors=FALSE,
"NA" = c(1L, 2L, 3L, 4L, 5L, 6L),
chr = c("chr1", "chr1", "chr1", "chr1", "chr1", "chr1"),
genome = c("hg19_refGene", "hg19_refGene", "hg19_refGene",
"hg19_refGene", "hg19_refGene", "hg19_refGene"),
region = c("CDS", "exon", "CDS", "exon", "CDS", "exon")
)
tibble::tribble(
~"NA", ~chr, ~genome, ~region,
1L, "chr1", "hg19_refGene", "CDS",
2L, "chr1", "hg19_refGene", "exon",
3L, "chr1", "hg19_refGene", "CDS",
4L, "chr1", "hg19_refGene", "exon",
5L, "chr1", "hg19_refGene", "CDS",
6L, "chr1", "hg19_refGene", "exon"
) You could go one step further and detect when the first column is a regular integer sequence |
The added quotes around |
I'll need to have a think about this one. My first reaction is row names that are 1:n are redundant so just blow them away. But then dealing with the actual row names still needs to happen. Also: Is it my imagination or is there another addin already that does this? |
This PR now has an interaction with #87 -- what about dropping |
Hey all, found this as I ran into this issue trying to copy from SO (where it seems this feature request originated). However, unlike in #61, I wasn't even able to # Using CRAN version 3.0.0
tribble_paste()
#> Could not paste clipboard as tibble. Text could not be parsed as table.
#> NULL
# Using jonocarroll's feature/space_separator branch
tibble::tribble(
~ID, ~Type, ~Group, ~Week, ~Value,
111, "A", "Pepper", -1, 10,
112, "B", "Salt", 2, 20,
113, "C", "Curry", 4, 40,
114, "D", "Rosemary", 9, 90,
211, "A", "Pepper", -1, 15,
212, "B", "Salt", 2, 30,
214, "D", "Rosemary", 9, 135
)
# And readr
readr::read_table(
"ID Type Group Week Value
111 A Pepper -1 10
112 B Salt 2 20
113 C Curry 4 40
114 D Rosemary 9 90
211 A Pepper -1 15
212 B Salt 2 30
214 D Rosemary 9 135"
)
#> # A tibble: 7 x 4
#> ID Type `Group Week` Value
#> <lgl> <chr> <chr> <dbl>
#> 1 NA 111 A Pepper -1 10
#> 2 NA 112 B Salt 2 20
#> 3 NA 113 C Curry 4 40
#> 4 NA 114 D Rosemary 9 90
#> 5 NA 211 A Pepper -1 15
#> 6 NA 212 B Salt 2 30
#> 7 NA 214 D Rosemary 9 135 Anyway, not really new findings, but just wanted to show additional interest in this feature. Thanks for the great package! |
Closes #61.
Simple fix to
guess_sep
to allow space to be used as a separator. Tested with the example provided.Also modified a test file for use with this