r - Error: could not find function "%>%" -
i'm using example, going through steps , working far except method below:
words <- dtm %>% as.matrix %>% colnames %>% (function(x) x[nchar(x) < 20]) error: not find function "%>%"
i don't understand benefit of using special operator %>% is, , feedback great.
you need install package magrittr first, should work.
install.packages("magrittr") library(magrittr) the pipe operator %>% introduced "decrease development time , improve readability , maintainability of code."
but has decide himself if fits workflow , makes things easier. more information on magrittr, click here.
not using pipe %>%, code return same code:
words <- colnames(as.matrix(dtm)) words <- words[nchar(words) < 20] words edit: (i extending answer because of useful comment made @molx)
despite being
magrittr, pipe operator more commonly used packagedplyr(which requires , loadsmagrittr), whenever see using%>%make sure shouldn't loaddplyrinstead.
Comments
Post a Comment