I get a warning about 63 parsning errors and the following warnings message:
In rbind(names(probs), probs_f) :
number of columns of result is not a multiple of vector length (arg 1)
I think this is because of how some of the string variables look like in the csv file. Those string variables are not enclosed with quotation marks, but they can include quotation marks. The file seems to be read correctly, but could I read the file in some way that does not produce any warnings? I assume I should somehow state that R should not care about what characters are found between the semicolons.
Also, how do I get to see all the 63 parsing errors? They are now truncated and I only see 2.
One of the benefits of using reprex (short for minimal reproducible example) is that it will give the full warning message, which, in this case, includes the answer to your question above!
See problems(...) for more details. In this case, that's problems(candidates). You're only seeing the first few here in the reprex, but you can run it and give it a name locally for further inspection. (All of this is also in the readr function reference for read_delim(), of which read_csv2() is just a special instance).
I also ran glimpse() in the reprex below for a peek into what the columns all look like.
Thank you for the suggestion to use reprex, and for the link to Jim's answer. Using that information I was able to read the file without any warnings using the following code.
library(tidyverse)
candidates <- read_csv2("https://data.val.se/val/val2018/valsedlar/partier/kandidaturer.skv",
locale=locale("sv",encoding="ISO-8859-1"), quote="")
#> Using ',' as decimal and '.' as grouping mark. Use read_delim() for more control.
#> Parsed with column specification:
#> cols(
#> .default = col_character(),
#> PARTIKOD = col_integer(),
#> LISTNUMMER = col_integer(),
#> ORDNING = col_integer(),
#> KANDIDATNUMMER = col_integer(),
#> Ă…LDER_PĂ…_VALDAGEN = col_integer(),
#> ANT_BEST_VALS = col_integer()
#> )
#> See spec(...) for full column specifications.
However, as indicated in the discussion on GitHub, this solution could cause problems if there are any semicolons in the string variables (but that might cause problems in any case).