Skip to content
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

FR: in colClasses of fread, allow column names not present in actual table #1602

Open
aushev opened this issue Mar 19, 2016 · 3 comments
Open

Comments

@aushev
Copy link

aushev commented Mar 19, 2016

I often need to read multiple tables that share some (but not all) columns which would be passed to colClasses. It would be then convenient to make one vector with all those column names, i.e. instead of

chrcols1 <- c('colA', 'colB')
dt1 <- fread(file1, colClasses=list(character=chrcols1))
chrcols2 <- c('colA', 'colC')
dt2 <- fread(file2, colClasses=list(character=chrcols2))
# etc

use

chrcolsAll <- c('colA', 'colB', 'colC')
dt1 <- fread(file1, colClasses=list(character=chrcolsAll))
dt2 <- fread(file2, colClasses=list(character=chrcolsAll))

Right now this is not allowed ( "Column name '%s' in colClasses[[%d]] not found" ) but instead of throwing an error we could just exclude those column names from further processing.

@aushev aushev changed the title FR: in colClasses, allow column names not found in actual table FR: in colClasses of fread, allow column names not present in actual table Mar 20, 2016
@gdmcdonald
Copy link

This would be a great feature!

@MichaelChirico
Copy link
Member

In current dev, this is a warning (DTWARN), whereas in the linked commit it was an error (STOP).

Is a warning too strict here? The idea is to relegate it to verbose output only? Or can we close this?

@gdmcdonald
Copy link

Ahhhhh yes the current dev solves all my problems! Thankyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants