Q:

Reading TXT files from AWS S3 from Rstudio via cloudyr/aws.s3 library ☁️

I'm trying to use aws.s3 library to read from AWS S3 from my Rstudio session. I'm following this instructions. The following lines
obj <-get_object("s3://my_bucket/myfile.csv")  
csvcharobj <- rawToChar(obj)  
con <- textConnection(csvcharobj)  
data <- read.csv(file = con)

works just fine for reading csv files. But the following alternative returns error for txt files.
obj <-get_object("s3://my_bucket/myfile.txt")  
csvcharobj <- rawToChar(obj)  
con <- textConnection(csvcharobj)  
data <- read.table(file = con)  
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
line 1 did not have 6 elements

Any suggested solution to this issue? Thank you.

A:

It turned out that it was an issue with my particular txt file or the particular s3 path. The above block works for another txt file. 
I think the question answer might be still helpful to keep. But, I leave that to the moderators' decisions of course. Thanks.

