Error saying names attribute 27 must be the same length as the vector 21

+1 vote

I'm running into a problem when trying to use the readHTMLTable function in the R package XML. When running

library(XML)
baseurl <- "http://www.pro-football-reference.com/teams/"
team <- "nwe"
year <- 2011
theurl <- paste(baseurl,team,"/",year,".htm",sep="")

readurl <- getURL(theurl)
readtable <- readHTMLTable(readurl)

I get the error message:

Error in names(ans) = header : 
'names' attribute [27] must be the same length as the vector [21]
Nov 12, 2018 in Data Analytics by Ali
• 11,360 points
4,138 views

1 answer to this question.

0 votes

When you end up with this error its obvious that it's having trouble matching the data with what it's parsed for header values. The simplest way around this is to simply turn off header parsing entirely:

table.list <- readHTMLTable(theurl, header=F)
answered Nov 12, 2018 by Maverick
• 10,840 points

Related Questions In Data Analytics

0 votes
1 answer

Error saying "duplicate 'row.names' are not allowed" when trying to setup my data for the mlogit-package

Take out the chid.var argument in your call to mlogit.data, ...READ MORE

answered Nov 12, 2018 in Data Analytics by Maverick
• 10,840 points
2,083 views
+1 vote
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,840 points
4,876 views
0 votes
1 answer

Plot two variables as lines on the same graph using ggplot

If you have small number of variables, ...READ MORE

answered Apr 17, 2018 in Data Analytics by kappa3010
• 2,090 points
5,073 views
0 votes
1 answer
0 votes
1 answer

": cannot open the connection" Error in R

There can be two reasons for this ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 52,350 points
5,110 views
+2 votes
1 answer

“subscript out of bounds” Error in r programming

This error is likely to occur when ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 52,350 points
9,580 views
+1 vote
1 answer

What does “replacement has” Error mean?

This error occurs when one tries to ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 52,350 points
715 views
0 votes
1 answer

Errors saying "Error: unexpected '}' in "}"

This is a syntax error: Enclose your if ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,840 points
3,138 views
+1 vote
1 answer
+1 vote
1 answer

Error saying "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY"

Try this: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ...READ MORE

answered Nov 12, 2018 in Data Analytics by Maverick
• 10,840 points
1,239 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP