Skip to content
Back to formatted view

Raw Message

Message-ID: <CABQyo84PYt+caZgxydaVMEgNm7S=G5HW9jMwSc41R+qtwqcxwQ@mail.gmail.com>
Date: 2016-05-10T04:58:51Z
From: Luca Meyer
Subject: Assistance with httr package with R version 3.3.0

Hello,

I am trying to run a code I have been using for a few years now after
downloading the new R version 3.3.0 and I get the following error:

> rm(list=ls())
> library(httr)
>
> #carico i dati da Google spreadsheets
> url <- "
https://docs.google.com/spreadsheets/d/102-jJ7x1YfIe4Kkvb9olQ4chQ_TS90jxoU0vAbFZewc/pubhtml?gid=0&single=true
"
> readSpreadsheet <- function(url, sheet = 1){
+   r <- GET(url)
+   html <- content(r)
+   sheets <- readHTMLTable(html, header=FALSE, stringsAsFactors=FALSE)
+   df <- sheets[[sheet]]
+   dfClean <- function(df){
+     nms <- t(df[1,])
+     names(df) <- nms
+     df <- df[-1,-1]
+     row.names(df) <- seq(1,nrow(df))
+     df
+   }
+   dfClean(df)
+ }
> dati <- readSpreadsheet(url)
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ?readHTMLTable? for
signature ?"xml_document"?
> rm(readSpreadsheet,url)

Can anyone suggest a solution to it?

Thanks,

Luca

	[[alternative HTML version deleted]]