0

I have been trying to read a very big (compared to computer's memory) data set and I thought it would be easier to use sqldf to import only selected columns. However, my code only imports the file's columns names and none of the data.

library(sqldf)

ka <- read.csv.sql("Filename.csv",header=TRUE,sep="\t",
                                  sql="SELECT Business,Product FROM file")

ka then gives me Business, Product column names, but not the data below them. I also get the message <0 rows> (or 0-length row.names)

What is more weird, is that the above function works with a sample on my personal laptop, but not with the employer's data.

Would anyone know what could be the reason?

Sotos
  • 51,121
  • 6
  • 32
  • 66
A K
  • 1
  • 2
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Sotos Feb 16 '18 at 12:46
  • Are you sure sep="\t" is required? I tried it with some sample csv data I made, and it worked ok without that – Jonny Phelps Feb 16 '18 at 13:24
  • For reading big files, maybe try: `data.table::fread("filename.csv", nrow = 10, select = c("Business", "Product"))` – David Klotz Feb 16 '18 at 13:40
  • Are the field separators and the end-of-line characters the same on the two files? Are the operating systems the same? – G. Grothendieck Feb 16 '18 at 14:09

0 Answers0