I have an API call that works when the string is created as a list. If instead take a row of a data frame it wrapsit in brackets [
] and fails.
I'm looking to create a list from the row of the data frame to get it to work again.
For example.
If I create a list using
Fields<-list("Sex"="M","Age"=10)
and then put that into a list:
body<-list("ID"="E1","Inputs"=Fields)
the body works fine
however if I have a dataframe, df
Sex Age
M 10
F 20
and i use:
body<-list("ID"="E1",df[1,])
It creates body as a list of 3, but the 3rd element itself is a data.frame with 1 row and 2 columns rather than a list.
How can I convert the single data frame row to a list?
Thanks!