You seem to have a typo. In the case that works your filename is "Mailles_2011a.dbf" but in the case that fails your filename is "Mailles_2011a.shp" (different extensions)
HTH, Eric On Sat, Apr 20, 2019 at 8:00 PM Patrick Giraudoux < patrick.giraud...@univ-fcomte.fr> wrote: > Dear listers, > > I am using the package foreign function read.dbf and meet the following > issue: > > i<-"Mailles_2011a.dbf" > > dbf<-read.dbf(i) > > works well BUT > > if I have a vector such as > > files <- c("Mailles_2011a.shp", "Mailles_2011p.shp", > "Mailles_2012a.shp", "Mailles_2012p.shp", "Mailles_2013a.shp", > "Mailles_2013p.shp", "Mailles_2014p.shp", "Mailles_2015a.shp", > "Mailles_2015p.shp", "Mailles_2016p.shp") > > for(i in files) { > dbf<-read.dbf(i) > names(dbf) > } > > gives the following error message: > > Error in read.dbf(i) : unable to open DBF file > > Same error with e.g. > > dbf<-read.dbf(files[1]) > > Any idea about what's happening? > > Patrick > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.