-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I've been working with a set of ragged files, and of course one of them has to be different. Most have only the "\n" EOL character while one has "\r\n". melt_tsv seems to recognize both and essentially inserts a new line.
library(meltr)
# melt_tsv appears to treat \r and \n as seperate eol characters
# Thus "b" gets bumped to row 3
melt_tsv("a\t\r\nb\t")
#> # A tibble: 5 × 4
#> row col data_type value
#> <dbl> <dbl> <chr> <chr>
#> 1 1 1 character a
#> 2 1 2 missing <NA>
#> 3 2 1 missing <NA>
#> 4 3 1 character b
#> 5 3 2 missing <NA>
# With only \n as eol "b" is on row 2
melt_tsv("a\t\nb\t")
#> # A tibble: 4 × 4
#> row col data_type value
#> <dbl> <dbl> <chr> <chr>
#> 1 1 1 character a
#> 2 1 2 missing <NA>
#> 3 2 1 character b
#> 4 2 2 missing <NA>
# It also seems to be fine with no missing values
melt_tsv("a\tc\r\nb\td")
#> # A tibble: 4 × 4
#> row col data_type value
#> <dbl> <dbl> <chr> <chr>
#> 1 1 1 character a
#> 2 1 2 character c
#> 3 2 1 character b
#> 4 2 2 character d
Created on 2024-05-31 with reprex v2.1.0
Metadata
Metadata
Assignees
Labels
No labels