{"action":"created","issue":{"url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/1","repository_url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton","labels_url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/1/comments","events_url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/1/events","html_url":"https://github.com/lvaudor/tuto_texte_Marmiton/issues/1","id":354317466,"node_id":"MDU6SXNzdWUzNTQzMTc0NjY=","number":1,"title":"Error in x[[which(names(x) == \"href\")]] ","user":{"login":"pnavaro","id":6410049,"node_id":"MDQ6VXNlcjY0MTAwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6410049?v=4","gravatar_id":"","url":"https://api.github.com/users/pnavaro","html_url":"https://github.com/pnavaro","followers_url":"https://api.github.com/users/pnavaro/followers","following_url":"https://api.github.com/users/pnavaro/following{/other_user}","gists_url":"https://api.github.com/users/pnavaro/gists{/gist_id}","starred_url":"https://api.github.com/users/pnavaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnavaro/subscriptions","organizations_url":"https://api.github.com/users/pnavaro/orgs","repos_url":"https://api.github.com/users/pnavaro/repos","events_url":"https://api.github.com/users/pnavaro/events{/privacy}","received_events_url":"https://api.github.com/users/pnavaro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-27T13:24:18Z","updated_at":"2018-08-27T13:31:26Z","closed_at":"2018-08-27T13:31:26Z","author_association":"NONE","body":"Hi, I try to learn the tutorial but I get an error, do you have an idea ?\r\n\r\n```r\r\nknitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE, cache=TRUE)\r\nlibrary(tidyverse)\r\nlibrary(purrr)\r\nlibrary(rvest)\r\nlibrary(tidytext)\r\nlibrary(proustr)\r\nlibrary(wordcloud)\r\nlibrary(widyr)\r\nlibrary(igraph)\r\nlibrary(ggraph)\r\n\r\npages <- str_c(\"http://www.marmiton.org/recettes/recherche.aspx?aqt=dessert&dt=dessert&pht=1\",\r\n               c(\"\",str_c(\"&start=\",seq(12,9000,by=12))))\r\npages[1:4]\r\n\r\nrecup_recettes <- function(page){\r\n  html <- read_html(page)\r\n  urls <- html  %>% \r\n    html_nodes(\"body\") %>% \r\n    html_nodes(\".recipe-card\") %>% \r\n    html_attrs() %>%\r\n    map(.f=function(x){x[[which(names(x)==\"href\")]]}) %>% \r\n    unlist()\r\n  tib=tibble(urls=urls)\r\n  return(tib)\r\n}\r\n\r\nif(!file.exists(\"data/recettes_sample.csv\")){\r\n  recettes <- pages%>%\r\n    map(.f=recup_recettes) %>%\r\n    bind_rows()\r\n  set.seed(33)\r\n  recettes_sample <- sample_n(recettes, 1000)\r\n  write_csv(recettes_sample,\"data/recettes_sample.csv\")\r\n}\r\nrecettes_sample <- read_csv(\"data/recettes_sample.csv\")\r\nhead(recettes_sample)\r\n```\r\n\r\n~~~\r\n Error in x[[which(names(x) == \"href\")]] : \r\n  attempt to select less than one element in get1index \r\n~~~\r\n\r\nThanks fo your time\r\n\r\nPierre\r\n"},"comment":{"url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/comments/416227444","html_url":"https://github.com/lvaudor/tuto_texte_Marmiton/issues/1#issuecomment-416227444","issue_url":"https://api.github.com/repos/lvaudor/tuto_texte_Marmiton/issues/1","id":416227444,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjIyNzQ0NA==","user":{"login":"pnavaro","id":6410049,"node_id":"MDQ6VXNlcjY0MTAwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6410049?v=4","gravatar_id":"","url":"https://api.github.com/users/pnavaro","html_url":"https://github.com/pnavaro","followers_url":"https://api.github.com/users/pnavaro/followers","following_url":"https://api.github.com/users/pnavaro/following{/other_user}","gists_url":"https://api.github.com/users/pnavaro/gists{/gist_id}","starred_url":"https://api.github.com/users/pnavaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnavaro/subscriptions","organizations_url":"https://api.github.com/users/pnavaro/orgs","repos_url":"https://api.github.com/users/pnavaro/repos","events_url":"https://api.github.com/users/pnavaro/events{/privacy}","received_events_url":"https://api.github.com/users/pnavaro/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T13:31:26Z","updated_at":"2018-08-27T13:31:26Z","author_association":"NONE","body":"I will take the file in the repository and not try to rewrite it. Sorry."}}
{"actor":{"display_login":"pnavaro"}}