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

s_attributes() fails for parent attribute #261

Closed
ablaette opened this issue Aug 24, 2023 · 2 comments
Closed

s_attributes() fails for parent attribute #261

ablaette opened this issue Aug 24, 2023 · 2 comments

Comments

@ablaette
Copy link
Collaborator

library(polmineR)

speeches <- corpus("GERMAPARL2") %>%
  subset(as.integer(protocol_lp) %in% 18:21) %>% 
  as.speeches(
    s_attribute_name = "speaker_name",
    gap = 50, # gap is 500 by default
    mc = cores_to_use
  )

# works
parties <- s_attributes(speeches, "speaker_party") %>% 
  unlist() %>% 
  tibble(doc = names(.), party = unname(.)) %>% 
  select(party, subcorpus)
 
# fails
dates <- s_attributes(speeches, "protocol_date") %>% 
  unlist() %>% 
  tibble(doc = names(.), date = unname(.)) %>% 
  select(party, date)
@ablaette
Copy link
Collaborator Author

This is identical with: #283 (comment)
The solution for #283 also solves this issue.

@ablaette
Copy link
Collaborator Author

This code actually works (and demonstrates that the issue is solved).

library(polmineR)
library(dplyr)

speeches <- corpus("GERMAPARL2") %>%
  subset(as.integer(protocol_lp) %in% 18:21) %>% 
  as.speeches(
    s_attribute_name = "speaker_name",
    gap = 50, # gap is 500 by default
    mc = cores_to_use
  )

# works
parties <- s_attributes(speeches, "speaker_party") %>% 
  unlist() %>% 
  tibble(doc = names(.), party = unname(.)) %>% 
  select(party, doc)

# fails
dates <- s_attributes(speeches, "protocol_date") %>% 
  unlist() %>% 
  tibble(name = names(.), date = unname(.)) %>% 
  select(name, date)

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

1 participant