2

I'm running this code to import the csv file into movies.

movies <-read.csv("https://github.com/fivethirtyeight/data/blob/master/fandango/fandango_score_comparison.csv",header=TRUE) 
names(movies)

Here I'm trying to get the names of the columns

{r seeing variable names,echo=FALSE} names(movies)

All I get is this

[1] "X..DOCTYPE.html."

What am I missing?

Vishesh Shrivastav
  • 2,079
  • 2
  • 16
  • 34
Teddy Liang
  • 23
  • 1
  • 3

1 Answers1

6

When reading data from github, you need to pass in the raw version of the data in read.csv(), you are using the display version. You can get the URL for the raw version by clicking on the Raw button displayed above the data.

enter image description here

movies <- read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/fandango/fandango_score_comparison.csv", header=TRUE)
Vishesh Shrivastav
  • 2,079
  • 2
  • 16
  • 34