I don't see how or why you want to do this, but it's a fun idea If I get it correctly, you want to store a dataframe in a QR code and then be able to retrieve it when scanned right?
This is my approach:
#Take a dataframe
myDataframe = data.frame(replicate(2,sample(0:50,24,rep=TRUE)))
#Generate the full dataframe as text using datapasta
#and remove white spaces and next line characters
myDataFrame = str_remove_all(
#Plot the data as a QR code
asp=1, col=c("white", "black"), axes=FALSE,
Note that QR codes have a limited amount of characters they can encode, so this will only work for relatively small data frames...
Also, in this code I removed all spaces from the data frame to conserve space in the QR code given all data was numeric. If the data contained strings, spaces between words would be removed with this code as well, so you should alter that if needed.
Hope this helps,