We are using R's plumber library to create an API that returns data in CSV format. For some reason, one of the strings returned is being wrapped with quotes, and we cannot figure out how to resolve this. We have the following example code below:
runapi.R
# !/usr/bin/env Rscript
library(plumber)
pr <- plumber::plumb("endpoints.R")
pr$run(host = "0.0.0.0", port = 8004)
endpoints.R
#* @param season The season we want
#* @get /preseason-preds
#* @serializer csv list(type="text/plain; charset=UTF-8")
preseasonPreds <- function(res, season = 2023) {
api_df <- readr::read_csv(file = 'data/our_csv.csv')
return(api_df)
}
data/our_csv.csv
TeamID,FeedID
NASH,148048
LAFC,147671
PUNI,275
Output when we hit this endpoint:
The issue is the quotes around NASH
. I am 99% sure there are no weird characters in this string. When we replace NASH
with NA
, or NSH
, there are no quotes returned. The only other string where I could recreate the issue of getting these quotes is NAS
.
What is it about NASH
, NAS
that results in quotes being returned around the string? It seems so random. Is there anyway to have the endpoint not return the quotes around this string?