Description Usage Arguments Value Examples
See available sentimentr data a data.frame. Note that
sentimentr_data
is the main function to be used but
available_data
is exposed to allow other packages to use the
functionality in a generic way.
1 2 3 | available_data(regex = NULL, package = "sentimentr", ...)
sentimentr_data(regex = NULL, package = "sentimentr", ...)
|
regex |
A regex to search for within the data columns. |
package |
The name of the package to extract data from. |
... |
Other arguments passed to |
Returns a data.frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | sentimentr_data()
available_data() ## generic version for export
available_data(package = 'datasets')
sentimentr_data('^hu')
sentimentr_data('^(hu|kot)')
combine_data(sentimentr_data('^(hu|kot)')[[1]])
## Not run:
if (!require("pacman")) install.packages("pacman")
pacman::p_load(sentimentr, tidyverse, magrittr)
sentiment_data <- sentimentr_data('^hu') %>%
pull(Data) %>%
combine_data() %>%
mutate(id = seq_len(n())) %>%
as_tibble()
sentiment_test <- sentiment_data %>%
select(-sentiment) %>%
get_sentences() %$%
sentiment(., by = c('id'))
testing <- sentiment_data %>%
left_join(sentiment_test, by = 'id') %>%
as_tibble() %>%
mutate(
actual = sign(sentiment),
predicted = sign(ave_sentiment)
)
testing %$%
ftable(predicted, actual)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.