As an example lets take df <- head(iris)
. How would I encode this into a base64 string. I need it for the GitHub API content argument.
At the moment I have been trying to use the base64encode()
function but get the "error in normalizePath".
Specifically for the GitHub API after some research the following code worked perfectly as it was able to decode and move the table to Github:
df1<-charToRaw(paste(capture.output(write.table(Table, quote=FALSE, row.names=FALSE , sep=",")), collapse="\n"))
base64_code<-base64enc::base64encode(df1)
This was able to be placed in the content argument of the rest API to update the file.