Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on slope creation code #3

Open
llamapolitics opened this issue Nov 5, 2019 · 1 comment
Open

Question on slope creation code #3

llamapolitics opened this issue Nov 5, 2019 · 1 comment

Comments

@llamapolitics
Copy link

Hi! I'm working through your text analytics code with my own data set (One focused on social reviews from multiple sites for a specific brand). But I keep getting an error when trying to create the slopes that you use to map out the trend in word usage.

This is the code:

slopes <- word_month_counts %>% nest(-word) %>% mutate(model = map(data, mod)) %>% unnest(map (model, tidy)) %>% filter(term == "year") %>% arrange(desc(estimate))

And this is the error I'm getting:

Error in map(model, tidy) : object 'model' not found
In addition: Warning message:
All elements of ... must be named.
Did you want data = c(month, n, month_total, percent, year)?

Any idea on what may be going on? I could share more information if this isn't enough. Everything prior to this point has worked, although I've had to replace some minor terms such as column names

@GuoYunZheSE
Copy link

Hi! I'm working through your text analytics code with my own data set (One focused on social reviews from multiple sites for a specific brand). But I keep getting an error when trying to create the slopes that you use to map out the trend in word usage.

This is the code:

slopes <- word_month_counts %>% nest(-word) %>% mutate(model = map(data, mod)) %>% unnest(map (model, tidy)) %>% filter(term == "year") %>% arrange(desc(estimate))

And this is the error I'm getting:

Error in map(model, tidy) : object 'model' not found
In addition: Warning message:
All elements of ... must be named.
Did you want data = c(month, n, month_total, percent, year)?

Any idea on what may be going on? I could share more information if this isn't enough. Everything prior to this point has worked, although I've had to replace some minor terms such as column names

I think the tidyr package api has changed a little since this was written - here's a modification to the "slopes" chunk that works:

slopes <- word_month_counts %>%
nest(data = -word) %>%
mutate(model = map(data, mod),
model = map(model,tidy)) %>%
unnest(model) %>%
filter(term == 'year') %>%
arrange(desc(estimate))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants