Skip to content

[R-Forge #5323] fread: colClasses does not convert to non-builtin types #491

@arunsrinivasan

Description

@arunsrinivasan

Submitted by: James Sams; Assigned to: Nobody; R-Forge link

If I set a column to numeric, character, etc., the conversion works as expected. However, if I set it to a user created class, it seems like fread gets confused. It recognises that the column is supposed to be converted, but doesn't do the conversion.

The message generated by fread in this situation (sample code attached) is:

# Detected eol as \n only (no \r afterwards), the UNIX and Mac standard.
# Using line 2 to detect sep (the last non blank line in the first 'autostart') ... none found (see ?fread). 
# Deducing this is a single column input. Otherwise, please specify 'sep' manually.
# First row with 1 fields occurs on line 1 (either column names or first row of data)
# All the fields on line 1 are character fields. Treating as the column names.
# Count of eol after first data row: 2
# Subtracted 1 for last eol and any trailing empty lines, leaving 1 data rows
# Type codes: 0 (first 5 rows)
# Column 1 ('date') was detected as type 'integer' but bumped to 'numeric' as requested by colClasses
#    0.000s (  0%) Memory map (rerun may be quicker)
#    0.000s (  0%) sep and header detection
#    0.000s (  0%) Count rows (wc -l)
#    0.000s (  0%) Column type detection (first, middle and last 5 rows)
#    0.000s (  0%) Allocation of 1x1 result (xMB) in RAM
#    0.000s (  0%) Reading data
#    0.000s (  0%) Allocation for type bumps (if any), including gc time if triggered
#    0.000s (  0%) Coercing data already read in type bumps (if any)
#    0.000s (  0%) Changing na.strings to NA
#    0.000s        Total

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions