I have the following code to import some data.
url <- "https://finance.yahoo.com/industry/Scientific_Technical_Instruments"
library(rvest)
read <- read_html(url) %>%
html_table()
library(plyr)
data <- ldply(read, data.frame)
However the data creates a data frame of 20 columns when there should be just 10. The column names of the data frame have not imported as they should and creates a number of NA values.
Is there a way in R to shift the column names across, then remove the NA columns created?