Skip to content

Commit

Permalink
⚡ adds support for space as a separator
Browse files Browse the repository at this point in the history
suitable test file
closes MilesMcBain#61
  • Loading branch information
jonocarroll committed Jul 23, 2018
1 parent d6adfc3 commit 12c72fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/tribble_paste.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ render_type_pad_to <- function(char_vec, char_type, char_length){
#'
#' @return the separator selected to parse char_vec as a table
#'
guess_sep <- function(char_vec){
candidate_seps <- c(",","\t","\\|",";")
guess_sep <- function(char_vec) {
candidate_seps <- c(",","\t","\\|",";"," ")
table_sample <- char_vec[1:min(length(char_vec),10)]

#handle seps at end of line. A sep at the end of line is effectively an NA in the last column.
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/brisbane_weather_empty_lines_spaces.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

X Location Min Max
Partly_cloudy. Brisbane 19 29
Partly_cloudy. Brisbane_Airport 18 27
Possible_shower. Beaudesert 15 30
Partly_cloudy. Chermside 17 29
Shower_or_two._Possible_storm. Gatton 15 32
Possible_shower. Ipswich 15 30
Partly_cloudy. Logan_Central 18 29
Mostly_sunny. Manly 20 26
Partly_cloudy. Mount_Gravatt 17 28
Possible_shower. Oxley 17 30
Partly_cloudy. Redcliffe 19 27

0 comments on commit 12c72fe

Please sign in to comment.