[R] Problem reading RDS files

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Mon Apr 23 08:58:45 CEST 2018


> On Apr 22, 2018, at 10:50 PM, mohammad moradi <mri.moradi using gmail.com> wrote:
> 
> I've tried to re-experiment the tutorial presented at
> http://www.rdatamining.com/docs/twitter-analysis-with-r and specifically
> aimed to use rds files (tweet records) at http://www.rdatamining.com/data/.

There was a question with similar content on SO a couple of days ago. I searched for and found the rds file that was claimed to be difficult to load but had no errors when I loaded it from a copy taken from the Web. The first error indicated that the user had failed to provide the correct path/name for the file the second error (for which no code was offered) reported was that their copy was corrupt.

> my_rds <- readRDS("~/RDataMining-Tweets-20160203.rds")
Warning: namespace ‘twitteR’ is not available and has been replaced
by .GlobalEnv when processing object ‘class’

# So I installed twitteR. I;m obviously not a user of the package and I don't use Twitter either.

trying URL 'https://cloud.r-project.org/bin/macosx/el-capitan/contrib/3.4/twitteR_1.1.9.tgz'
Content type 'application/x-gzip' length 466439 bytes (455 KB)
==================================================
downloaded 455 KB


The downloaded binary packages are in
	/var/folders/yq/m3j1jqtj6hq6s5mq_v0jn3s80000gn/T//RtmpfbHYT3/downloaded_packages
> str(my_rds)
List of 447
 $ :Loading required package: twitteR

Attaching package: ‘twitteR’

The following object is masked from ‘package:acs’:

    name

The following objects are masked from ‘package:dplyr’:

    id, location

Reference class 'status' [package "twitteR"] with 17 fields
  ..$ text         : chr "Vacancy of Data Scientist – Healthcare Analytics, Adelaide, Australia\nhttps://t.co/3xDFIJskj8"
  ..$ favorited    : logi FALSE
  ..$ favoriteCount: num 2
  ..$ replyToSN    : chr(0) 
  ..$ created      : POSIXct[1:1], format: "2015-12-30 05:02:49"
  ..$ truncated    : logi FALSE
#---- snipped excessive output


So this puts the onus on you to show the code that you used that was giving errors. Also need version numbers (OS, R, packages) and all the usual information outlined in the Posting Guide.

-- 
David.


> 
> On Sun, Apr 22, 2018 at 9:16 PM, Jeff Newmiller <jdnewmil using dcn.davis.ca.us>
> wrote:
> 
>> Wouldn't the obvious problem be that your data file is corrupted or was
>> never created  using saveRDS in the first place? Can you show us a complete
>> example of creating and attempting to read what was just created?
>> 
>> On April 22, 2018 10:20:05 AM CDT, mohammad moradi <mri.moradi using gmail.com>
>> wrote:
>>> Hi there,
>>> 
>>> I faced a weird problem doing a seemingly simple task in R.
>>> Specifically,
>>> when trying for reading an RDS file from the working directory, the
>>> following error is appeared.
>>> 
>>> Code:
>>> 
>>> records <- readRDS("tweets.rds")
>>> 
>>> 
>>> Error:
>>> 
>>> Error in readRDS("tweets.rds") : error reading from connection
>>> In addition: Warning message:
>>> In readRDS("tweets.rds") : invalid or incomplete compressed data
>>> 
>>> 
>>> Thanks,
>>> 
>>> Mohammad
>>> 
>>>      [[alternative HTML version deleted]]
>>> 
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> --
>> Sent from my phone. Please excuse my brevity.
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law




More information about the R-help mailing list