How to use readHTMLTable without turning off the first line

This is the table I'm trying to clear from online to R

What happens when I run the following code, the first row of the table is truncated, for example, the table starts with Justin Tucker instead of Stephen Gotzkowski.

library(XML)
kicker_1<- paste("http://www.nfl.com/stats/categorystats?archive=false&conference=null&statisticPositionCategory=FIELD_GOAL_KICKER&season=2013&seasonType=REG&experience=&tabSeq=1&qualified=false&Submit=Go")
kickers_13<- readHTMLTable(kicker_1)

from this point, the first row of the table is disabled, is there something in my link that I need to fix?

0
source share
1 answer

The problem you are facing is a bit strange. I got the first line by setting the argument headerto FALSE. Unfortunately, you may have to manually fill in the column names.

library(XML)
url <- "http://www.nfl.com/stats/categorystats?archive=false&conference=null&statisticPositionCategory=FIELD_GOAL_KICKER&season=2013&seasonType=REG&experience=&tabSeq=1&qualified=false&Submit=Go"
x <- readHTMLTable(url, header = FALSE, which = 1)
head(x)
##   V1                 V2  V3 V4 V5 V6 V7 V8 V9 V10 V11   V12 V13   V14 V15   V16 V17 V18 V19 V20 V21 V22 V23
## 1  1 Stephen Gostkowski  NE  K 38 41 93  0 54 1-1 100   8-8 100 13-13 100 13-11  85 6-5  83  44  44 100   0
## 2  1      Justin Tucker BAL  K 38 41 93  0 61 0-0   0 10-10 100 13-12  92 11-10  91 7-6  86  26  26 100   0
## 3  3     Adam Vinatieri IND  K 35 40 88  1 52 0-0   0   6-6 100 11-10  91 17-15  88 6-4  67  34  34 100   0
## 4  4         Nick Novak  SD  K 34 37 92  2 50 1-1 100   9-9 100 16-13  81   9-9 100 2-2 100  42  42 100   0
## 5  5      Dan Carpenter BUF  K 33 36 92  0 55 0-0   0 13-13 100   6-6 100 11-10  91 6-4  67  32  32 100   0
## 6  5       Mason Crosby  GB  K 33 37 89  0 57 1-1 100 13-13 100   8-8 100   8-6  75 7-5  71  42  42 100   0
+2
source

Source: https://habr.com/ru/post/1537597/


All Articles