title: How do I fix the “No encoding Supplied” error?
body: <p>I am facing difficulties after running the code and trying to export the dataset to a spreadsheet or txt.file.
  I am newbie to R, so maybe this question is trivial.</p>
  
  <p>After running the following code:</p>
  
  <pre><code>eia_series &lt;- function(api_key, series_id, start = NULL, end = NULL, num = NULL, tidy_data = "no", only_data = FALSE){
    # max 100 series
    # test if num is not null and either start or end is nut null. Not allowed
    # api_key test for character.
    # series_id test for character.
    # if start/end not null, then check if format matches series id date format
    # parse date and numerical data
  
    # parse url
    series_url &lt;- httr::parse_url("http://api.eia.gov/series/")
    series_url$query$series_id &lt;- paste(series_id, collapse = ";")
    series_url$query$api_key &lt;- api_key
    series_url$query$start &lt;- start
    series_url$query$end &lt;- end
    series_url$query$num &lt;- num
  
    # get data
    series_data &lt;- httr::GET(url = series_url)
    series_data &lt;- httr::content(series_data, as = "text")
    series_data &lt;- jsonlite::fromJSON(series_data)
  
    # Move data from data.frame with nested list and NULL excisting
    series_data$data &lt;- series_data$series$data
    series_data$series$data &lt;- NULL
  
    # parse data
    series_data$data &lt;- lapply(X = series_data$data, 
                           FUN = function(x) data.frame(date = x[, 1], 
                                                        value = as.numeric(x[, 2]), 
                                                        stringsAsFactors = FALSE))
  
    # add names to the list with data
    names(series_data$data) &lt;- series_data$data
  
    # parse dates
    series_data$data &lt;- eia_date_parse(series_list = series_data$data, format_character = series_data$series$f)
  
    # tidy up data
    if(tidy_data == "tidy_long"){
  
      series_data$data &lt;- lapply(seq_along(series_data$data), 
                             function(x) {cbind(series_data$data[[x]], 
                                                series_time_frame = series_data$series$f[x],
                                                series_name = series_data$series$series_id[x], 
                                                stringsAsFactors = FALSE)})
  series_data$data &lt;- do.call(rbind, series_data$data)
    } 
  
    # only data
    if(only_data){
      series_data &lt;- series_data$data
    }
  
    return(series_data)
  }
  </code></pre>
  
  <p>After running the function</p>
  
  <pre><code>eia_series(api_key = "XXX",series_id = c("PET.MCRFPOK1.M", "PET.MCRFPOK2.M"))
  </code></pre>
  
  <p>I tried to "transfer" the data in order to export it but got the following error:</p>
  
  <blockquote>
    <p>No encoding supplied: defaulting to UTF-8.</p>
  </blockquote>
  
  <p>I don't understand why. Could you help me out?</p>