excel - Converting .dbf to .xlsx in R -
hey i'm pretty new @ this. trying convert dbf file gis excel form in rstudio easier play with. appreciate comes way: keeps showing error:could not find function "convert"
library(foreign) library(translations) install.packages("translate") install.packages("rio") install.packages("mtcars") library(car) files <- list.files(path="d:/___transfer/masteraltkrs", pattern="*.dbf", full.names=t, recursive=false) for(i in files) { oldfile <- sub(".dbf",".xlsx",i) convert(oldfile, i) }
you have 2 options in case. either way have tell r convert() function rio package. can either add line says library(rio) (i.e. require(rio)), or can use rio::convert() in line uses function. see below examples.
option 1:
library(foreign) library(translations) install.packages("translate") install.packages("rio") install.packages("mtcars") library(car) library(rio) files <- list.files(path="d:/___transfer/masteraltkrs", pattern="*.dbf", full.names=t, recursive=false) for(i in files) { oldfile <- sub(".dbf",".xlsx",i) convert(oldfile, i) }
option 2:
library(foreign) library(translations) install.packages("translate") install.packages("rio") install.packages("mtcars") library(car) files <- list.files(path="d:/___transfer/masteraltkrs", pattern="*.dbf", full.names=t, recursive=false) for(i in files) { oldfile <- sub(".dbf",".xlsx",i) rio::convert(oldfile, i) }
Comments
Post a Comment