rOpenGov / dkstat

API connection to the StatBank from Statistics Denmark

Home Page:http://ropengov.github.io/dkstat/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$ operator is invalid for atomic vectors

Deleetdk opened this issue · comments

dst_gifte_2018_meta = dkstat::dst_meta("VIE4")
dst_gifte_2018 = dkstat::dst_get_data("VIE4",
                                      Tid = "2018", 
                                      KVIOPR = dst_gifte_2018_meta$values$KVIOPR$text, 
                                      MANOPR = dst_gifte_2018_meta$values$MANOPR$text
                                      )

Inspection of the call using debugonce() shows that the error is from:

  if (httr::status_code(dst_data) != 200) {
    stop(httr::content(dst_data, as = "text", encoding = "UTF-8")$message)
  }

The status code is 404. The resource has been moved is the real error, but it's not found under the $message call, hence the error.

Browse[2]> httr::content(dst_data, as = "text", encoding = "UTF-8")
[1] "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n<title>404 - File or directory not found.</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\"trebuchet MS\", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id=\"header\"><h1>Server Error</h1></div>\r\n<div id=\"content\">\r\n <div class=\"content-container\"><fieldset>\r\n  <h2>404 - File or directory not found.</h2>\r\n  <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n"

Seems DST updated their API and it no longer works.

@krose no longer maintained or?