There are two ways to fix this:
- At the source by changing the first line from
,Name,mfr,type,calories,protein,fat,sodium,fiber,carbo,sugars,shelf,vitamins,serving_Size,cups
if it's a csv file, by removing the first comma on that line.
- You don't always have control over the source, however, so here's another way, using the
{utils} package
withrows <- read.csv("https://raw.githubusercontent.com/shifteight/R-lang/master/ISLR/College.csv", header = TRUE, row.names = 1)
head(withrows)
#> Private Apps Accept Enroll Top10perc Top25perc
#> Abilene Christian University Yes 1660 1232 721 23 52
#> Adelphi University Yes 2186 1924 512 16 29
#> Adrian College Yes 1428 1097 336 22 50
#> Agnes Scott College Yes 417 349 137 60 89
#> Alaska Pacific University Yes 193 146 55 16 44
#> Albertson College Yes 587 479 158 38 62
#> F.Undergrad P.Undergrad Outstate Room.Board Books
#> Abilene Christian University 2885 537 7440 3300 450
#> Adelphi University 2683 1227 12280 6450 750
#> Adrian College 1036 99 11250 3750 400
#> Agnes Scott College 510 63 12960 5450 450
#> Alaska Pacific University 249 869 7560 4120 800
#> Albertson College 678 41 13500 3335 500
#> Personal PhD Terminal S.F.Ratio perc.alumni Expend
#> Abilene Christian University 2200 70 78 18.1 12 7041
#> Adelphi University 1500 29 30 12.2 16 10527
#> Adrian College 1165 53 66 12.9 30 8735
#> Agnes Scott College 875 92 97 7.7 37 19016
#> Alaska Pacific University 1500 76 72 11.9 2 10922
#> Albertson College 675 67 73 9.4 11 9727
#> Grad.Rate
#> Abilene Christian University 60
#> Adelphi University 56
#> Adrian College 54
#> Agnes Scott College 59
#> Alaska Pacific University 15
#> Albertson College 55
Created on 2019-12-26 by the reprex package (v0.3.0)