Skip to content

Set column types for csv #5

@shawnbrar

Description

@shawnbrar

I am using a payments dataset from Austin Text Open Data. I am trying to load the data with the following code:-

library(ff)
asd <- read.table.ffdf(file = "~/Downloads/Fiscal_Year_2010_eCheckbook_Payments.csv", first.rows = 100, next.ros = 50, FUN = "read.csv", VERBOSE = TRUE)

This shows me the following error:-

read.table.ffdf 301..Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
scan() expected 'an integer', got '7AHM'

This happens on 339th line of csv file at 5th column of the dataset. The reason why I think this is happening is that all the values of the 5th column are integers where as this happens to be string. But the actual type of the column should be character.

So I wanted to know if there was a way I could set the types of the column

Below I am providing the types for all the columns in a vector:-

c("character","integer","integer","character","character", "character","character","character","character","character","integer","character","character","character","character","character","character","character","integer","character","character","character","character","character","integer","integer","integer","character","character","character","character","double","character","integer")

You can also find the type of each column from the description of the dataset.

Please also keep in mind that I am very new to this library. Practically just found out about it today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions