Thanks @fritsander for the clarification. Looking back on your question, I see what you were intending to accomplish, but it would have been helpful to have a link to the raw file so we could see where that piece of data ends (which is where you wanted to start reading in the data). I'd actually be curious to see if you could use something like https://data.world/, as it's main purpose is to host publicly available data, such as files like this, and it's free. I've been pretty impressed with their offering from what I've used so far. Does that make sense?
I'd also strongly encourage you to use a text editor to view the raw file for errors (Visual Studio Code is amazing for this, also free: https://code.visualstudio.com/ )
Let me know if the below code is what you were expecting,
@cole idk why, but I keep seem to get this warning error(see below for full output):
Warning message:
In rbind(names(probs), probs_f) :
number of columns of result is not a multiple of vector length (arg 2)
I think you could also use readr::read_csv as well. Let me know if this helps.
path <- "~/Downloads/KNMI_20171127_hourly.txt"
library(tidyverse)
#> ── Attaching packages ──────────────────────────────────────────── tidyverse 1.2.1 ──
#> ✔ ggplot2 2.2.1 ✔ purrr 0.2.4
#> ✔ tibble 1.3.4 ✔ dplyr 0.7.4
#> ✔ tidyr 0.7.2 ✔ stringr 1.2.0
#> ✔ readr 1.1.1 ✔ forcats 0.2.0
#> ── Conflicts ─────────────────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
data <- readr::read_delim(path, delim = ',', skip = 81)
#> Parsed with column specification:
#> cols(
#> .default = col_character(),
#> YYYYMMDD = col_integer()
#> )
#> See spec(...) for full column specifications.
#> Warning in rbind(names(probs), probs_f): number of columns of result is not
#> a multiple of vector length (arg 2)
#> Warning: 1 parsing failure.
#> row # A tibble: 1 x 5 col row col expected actual file expected <int> <chr> <chr> <chr> <chr> actual 1 1 <NA> 25 columns 1 columns '~/Downloads/KNMI_20171127_hourly.txt' file # A tibble: 1 x 5
glimpse(data)
#> Observations: 62,929
#> Variables: 25
#> $ `# STN` <chr> "# ", " 391", " 391", " 391", " 391", " 391", " ...
#> $ YYYYMMDD <int> NA, 20171001, 20171001, 20171001, 20171001, 20171001,...
#> $ ` HH` <chr> NA, " 1", " 2", " 3", " 4", " 5", " ...
#> $ ` DD` <chr> NA, " 170", " 170", " 170", " 190", " 150", " 1...
#> $ ` FH` <chr> NA, " 20", " 20", " 20", " 20", " 20", " ...
#> $ ` FF` <chr> NA, " 20", " 20", " 20", " 10", " 20", " ...
#> $ ` FX` <chr> NA, " 30", " 30", " 40", " 30", " 40", " ...
#> $ ` T` <chr> NA, " 96", " 96", " 95", " 97", " 98", " 1...
#> $ ` T10` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` TD` <chr> NA, " 93", " 88", " 87", " 92", " 90", " ...
#> $ ` SQ` <chr> NA, " 0", " 0", " 0", " 0", " 0", " ...
#> $ ` Q` <chr> NA, " 0", " 0", " 0", " 0", " 0", " ...
#> $ ` DR` <chr> NA, " 0", " 0", " 0", " 0", " 0", " ...
#> $ ` RH` <chr> NA, " 0", " 0", " 0", " 0", " 0", " ...
#> $ ` P` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` VV` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` N` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` U` <chr> NA, " 98", " 95", " 94", " 96", " 94", " ...
#> $ ` WW` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` IX` <chr> NA, " 6", " 6", " 6", " 6", " 6", " ...
#> $ ` M` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` R` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` S` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` O` <chr> NA, " ", " ", " ", " ", " ", " ...
#> $ ` Y` <chr> NA, " ", " ", " ", " ", " ", " ...
problems(data)
#> # A tibble: 1 x 5
#> row col expected actual file
#> <int> <chr> <chr> <chr> <chr>
#> 1 1 <NA> 25 columns 1 columns '~/Downloads/KNMI_20171127_hourly.txt'