Skip to content

Various fread fixes - #2742

Merged
mattdowle merged 6 commits into
masterfrom
fread
Apr 13, 2018
Merged

mattdowle merged 6 commits into
masterfrom
fread

Conversation

@mattdowle

@mattdowle mattdowle commented Apr 12, 2018 •

Copy link
Copy Markdown
Member

Closes #2735
Closes #2697

@mattdowle mattdowle added this to the v1.10.6 milestone Apr 12, 2018
@codecov-io

codecov-io commented Apr 13, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #2742 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2742      +/-   ##
==========================================
+ Coverage   93.43%   93.44%   +<.01%     
==========================================
  Files          61       61              
  Lines       12298    12314      +16     
==========================================
+ Hits        11491    11507      +16     
  Misses        807      807
Impacted Files Coverage Δ
R/fread.R 96.87% <100%> (+0.32%) ⬆️
src/fread.c 97.98% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 920c918...b0e75fb. Read the comment docs.

Comment thread R/fread.R Outdated
tt = grep("^ +$", na.strings)
if (length(tt)) {
warning('na.strings contains some blank strings. They have been removed. strip.white=TRUE (default) together with na.strings="" turns any number of spaces into NA in string columns')
na.strings = na.strings[-tt]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be

tt = grep("^\\s+$", na.strings)
if (strip.white && length(tt)) {
  warning('na.strings contains strings consisting only of whitespace, yet strip.white=TRUE. These will be ignored: strip.white=TRUE (default) together with na.strings="" turns any number of spaces into NA in string columns'.)
}

i.e. not just repeated spaces and not 'blank' strings but 'whitespace-only' strings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted. Yes, will do.

Comment thread R/fread.R Outdated
na.strings = na.strings[-tt]
}
tt = which(substring(na.strings,1L,1L)==" " || substring(na.strings, nn<-nchar(na.strings), nn)==" ")
if (length(tt)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| not || I think. Or alternatively,

if (any(substring(na.strings,1L,1L)==" ") || any(substring(na.strings, nn<-nchar(na.strings), nn)==" ")) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted. Thanks, will do.

@mattdowle
mattdowle merged commit e64b952 into master Apr 13, 2018
@mattdowle
mattdowle deleted the fread branch April 13, 2018 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants