Skip to content

Obtaining different object from same file #5346

@luigidolcetti

Description

@luigidolcetti

Hi,

probably a very simple issue to fix but I am strugling to solve:

I have a txt numeric table with column header.

identical(
data.table::fread(fileName,sep='\t',header = T,check.names = F,colClasses = 'numeric'),
data.table::fread(fileName,sep='\t',header = T,check.names = F,colClasses = 'numeric'))

return FALSE most of the time

while

identical(
data.table::fread(fileName,sep='\t',header = T,check.names = F,colClasses = 'character'),
data.table::fread(fileName,sep='\t',header = T,check.names = F,colClasses = 'character'))

return always TRUE

On the other hand base read.table() does not have this issue (but it's way slower).
I would prefere to avoid loading the table as character to coerce it to numeric later (because of speed, otherwise I would have used read.table).

Any suggestion on how to read the same file twice and obtain identical objects (and why this is happening)?

Thank you in advance for help,
Luigi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions