我正在尝试创建一个工作流程
下面的内容似乎与我想要的非常接近,但我很难弄清楚为什么我在Species
列中有额外的引号。
library(dplyr)
write.csv(iris, "iris.csv", row.names = FALSE)
my_db <- src_sqlite("my_db.sqlite3", create = T)
con <- dbConnect("SQLite", dbname = "my_db.sqlite3")
dbWriteTable(con, name="iris", value="iris.csv",
row.names=FALSE, header=TRUE, sep = ",", eol = "\r\n", overwrite = TRUE,
quote = "\"", comment.char = "")
iris_sqlite <- tbl(src_sqlite("my_db.sqlite3"), "iris")
iris_sqlite %>%
collect %>%
str
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 150 obs. of 5 variables:
$ Sepal_Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
$ Sepal_Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
$ Petal_Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
$ Petal_Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
$ Species : chr "\"setosa\"" "\"setosa\"" "\"setosa\"" "\"setosa\""