Запись файла .dbf через RSTudio - PullRequest
0 голосов
/ 12 марта 2019

Я столкнулся с проблемой при использовании приведенного ниже сценария.Все работают нормально, за исключением последней строки, которая приводит к ошибке ниже.

enter image description here

# read dbf
library(foreign)
setwd("C:/Users/JGGliban/Desktop/Work/ADMIN/Other Stream/PH")

# Combine multiple dbf files
# library('tidyverse')
# List all files ending with dbf in directory
dbf_files <- list.files(pattern = c("*.DBF","*.dbf"), full.names = TRUE)
# Read each dbf file into a list
dbf_list <- lapply(dbf_files, read.dbf, as.is = FALSE)
# Concatenate the data in each dbf file into one combined data frame
data <- do.call(rbind, dbf_list)
# Write dbf file - max-nchar is the maimum number of characters allowed in a character field. After the max, it will be truncated.
x <- write.dbf(data, file, factor2char = TRUE, max_nchar = 254)

1 Ответ

0 голосов
/ 12 марта 2019

Код изменен на:

x <- write.dbf(data, "file.dbf", factor2char = TRUE, max_nchar = 254)
...