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

Progress report 2 comments #1

Open
djvill opened this issue Nov 29, 2021 · 0 comments
Open

Progress report 2 comments #1

djvill opened this issue Nov 29, 2021 · 0 comments

Comments

@djvill
Copy link
Member

djvill commented Nov 29, 2021

Looks like you've made great progress! I'm really pleased to see that you seem to have pushed through some of the head-spinning "where do I start first?" challenges

Can you share your full script? That would help me give you the best advice possible!

Re: Problem 1 and problem 2, these are really the same problem, in a way. That is, if you create a mega-function, then it's just a matter of iterating over all the HTMLs to get all the data you need--magic!

Let's say for the sake of argument that mnogopuno(), isa_iraova(), etc., all output a single element. Then your mega-function could look something like this:

BCS_Dialect <- function(x) { 
  dat <- input_data(x)
  tibble(html = x,
		 mnogopuno = mnogopuno(dat),
		 isa_iraova = isa_iraova(dat),
		 [...]
		 )
}

If your functions don't all output a single element, then you'll need to get a little more creative. For example, if mnogopuno() outputs a 2-element vector, you could do...

BCS_Dialect <- function(x) { 
  dat <- input_data(x)
  mp <- mnogopuno(dat)
  tibble(html = x,
		 mnogo = mp[1],
		 puno = mp[2],
		 isa_iraova = isa_iraova(dat),
		 [...]
		 )
}

Once you've gotten your mega-function into shape, Problem #1 is easy. All you need is a vector of URLs, which you can pipe into purrr::map_dfr() with your mega-function to create a mega-dataframe: c("https://hr.wikipedia.org/wiki/Kosovo", "https://sr.wikipedia.org/wiki/%D0%9A%D0%BE%D1%81%D0%BE%D0%B2%D0%BE", [...]) %>% map_dfr(BCS_Dialect)

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