Hi to everyone!
I'm just trying to create a dataset taking data from 2 urls, but i'm encountering an error.
When I create the variable, it will be rewritten by the next one observation(url), i wanna know if there is any method to get it not rewritten or(and it will be perfect) if i can add the first 100 object (the object selected contains 100 value each url) from the first url, to the second url, so i can get a variable of 200 value.
Using a print screen image is not the best way to post a question on here, because we would have to read and type everything by hand if we like to work with your code. Please read the guide on how to create a reprex to make sure folk can start helping your more quickly in future. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:
The reason you overwrite now is because in your loop you are writing every time to a thus overwriting the previous values. You can use an apply statement to save everything into a list like so
# c is your vector of urls
myData = lapply(c, function(url){
page = read_html(url)
a = html_nodes(page, ".number")
html_text(a)
})