1
我試圖通過R.創建SQLite數據庫(它似乎不是很方便,但它應該工作。)錯誤:`callback`必須有兩個或多個參數 - readr
我使用readr和dplyr包。當我擁有龐大的數據集,我試圖通過read_delim_chunked分裂的數據集,並調用回調函數我寫道:
modifier<-function(chunk){
result<-cbind(chunk %>%
filter(X1=="T") %>%
select(X2) %>% transmute(date=parse_date_time2(X2, orders = "%Y-%m-%d %H:%M:%S")),
chunk %>%
filter(X1=="U") %>%
select(X2) %>% transmute(str_sub(X2, 20)),
chunk %>%
filter(X1=="W")%>%
select(X2))
names(result)<-c("time", "user", "tweet")
db_insert_into(con=my_db$con, table="my_fav_table", values=result)
}
但是,調用read_delim_chunked時:
read_delim_chunked(file="/datadrive/tweets2009-07.txt",
chunk_size = 99999,
callback = modifier,
delim = "\t",
escape_double = FALSE,
col_names = FALSE,
trim_ws = TRUE,
skip = 1)
我得到這個奇怪的錯誤:
Error:
callback
must have two or more arguments
什麼是傳遞到第二個參數,它需要在那裏?
感謝
嘗試添加第二個參數並查看傳遞的內容,然後嘗試使用調試器運行。這裏有一些可能的提示?DataFrameCallback – Spacedman