मैं वास्तविक पुस्तकालयोंdplyr :: mutate_each के साथ नेमस्पेस्ड फ़ंक्शन का उपयोग कैसे करें?
dplyr::tbl_df(iris) %>%
dplyr::mutate_each(dplyr::funs(stringi::stri_trim_both))
संलग्न बिना कुछ बाहरी कार्यों के साथ dplyr::mutate_each
उपयोग करने के लिए कोशिश कर रहा हूँ, लेकिन यह निम्न त्रुटि के साथ विफल:
Error: unsupported type for column 'Sepal.Length' (CLOSXP, classes = function)
जब मैं data.table
data.frame
के बजाय का उपयोग करें:
Error in `[.data.table`(`_dt`, , `:=`(Sepal.Length, stringi::stri_trim_both), : RHS of assignment is not NULL, not an an atomic vector (see ?is.atomic) and not a list column.
यदि मैं स्थानीय वैरिएबल का उपयोग करता हूं तो नीचे की तरह काम करता है।
trim_both <- stringi::stri_trim_both
dplyr::tbl_df(iris) %>% dplyr::mutate_each(dplyr::funs(trim_both))
यह एक इष्टतम समाधान नहीं है लेकिन मैं इसके साथ रह सकता हूं। फिर भी मैं एक स्पष्टीकरण के लिए आभारी हूं कि समस्या का स्रोत क्या है।
सत्र जानकारी:
R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.4.1
loaded via a namespace (and not attached):
[1] assertthat_0.1 DBI_0.3.1 lazyeval_0.1.10.9000
[4] magrittr_1.5 parallel_3.1.1 Rcpp_0.11.4
[7] stringi_0.4-1 tools_3.1.1
नोट: यह समस्या नहीं रह गया है dplyr
0.7.2 में होता है।