Error saying "'names' attribute [27] must be the same length as the vector [21]"

0 votes

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
• 10,290 points
82 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,000 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,000 points
158 views
0 votes
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,000 points
186 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,010 points
630 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
• 35,750 points
197 views
0 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
• 35,750 points
562 views
0 votes
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
• 35,750 points
30 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,000 points
185 views
0 votes
1 answer
0 votes
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,000 points
47 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.