danicat / read.dbc

An R package for reading data in the DBC (compressed DBF) format used by DATASUS.
69 stars 29 forks source link

Error to find file with read.dbc #10

Closed leandrobi closed 3 years ago

leandrobi commented 4 years ago

Hi, I used setwd("C:/Users/leand/Desktop/dbc") for set the path with my files After, I put library("read.dbc") but when I try to pass for the row with x <- read.dbc(system.file("PASC2007.dbc")), I'm receiving this message: Error in dbc2dbf(file, out) : Input file does not exist.

In the folder, the file is there.

Code: setwd("C:/Users/leand/Desktop/dbc")

library("read.dbc") x <- read.dbc(system.file("PASC2007.dbc")) str(x)

Console:

setwd("C:/Users/leand/Desktop/dbc") library("read.dbc") x <- read.dbc(system.file("PASC2007.dbc")) Error in dbc2dbf(file, out) : Input file does not exist.

CauanCabral commented 3 years ago

I had the same issue following manual instructions, but it is our fault.

The system.file() usage in manual is to enable a demo with packaged dbc files.

To load file from local path, we should pass it name directly to read.dbc function:

x <- read.dbc("PASC2007.dbc")
danicat commented 3 years ago

@CauanCabral yes, the example in the documentation must be runnable by CRAN's standards, so that is designed for the internal tests to pass. In the real world you most likely won't want to use system.file.