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

Set column types for csv #5

Open
shawnbrar opened this issue Sep 20, 2020 · 0 comments
Open

Set column types for csv #5

shawnbrar opened this issue Sep 20, 2020 · 0 comments

Comments

@shawnbrar
Copy link

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.

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

No branches or pull requests

1 participant