My issue is that I've managed to, with great assistance from this community, scrape much of the data I desire; however, I have not managed to organize it in any meaningful way. The links I used in source are a sample of the many, many links I have for this project that are representative of all of them
library(rvest)
library(tidyverse)
#source links
source<-c("http://www.ufcstats.com/fighter-details/f2688492b9a525a3","http://www.ufcstats.com/fighter-details/f1fac969a1d70b08")
fp_e<-map(source, function(career_data){
read_html(career_data)%>%
html_nodes("div ul li")%>%
html_text()%>%
#cleans up the data a bit
str_replace_all(.,"\n\\s+\n\\s+","")%>%
as.data.frame(.)
})
What I want to do with this list is to turn it into a usable dataframe. My original idea was to transpose() it after as.data.frame(); however, all it did was put everything in a single row. Additionally, I was unable to index the data frame. This lead me to believe the data frame was not set up how I thought it was. I want to be more specific here but I'm honestly quite confused at this point.
Searching around, I found this question and the answer by neilfws gave me an idea of building the dataframe and inserting the data into it; however, I don't even know where to start. I'm also unsure if it's necessary to do that when it's already set up in a format I like.
This is the first real-world R application I've tried and I'm really stumbling on how to organize this data. Thank you for any help and suggestions!