Skip to content

ReadItem: Error

3 messages · Jeff Reichman, Bert Gunter

#
Anyone see what I might be doing wrong? Corrupted rds file maybe. The error
would suggest I'm using an older version of R except I'm running both the
latest RStudio and R versions.

# Load in the tidyverse, raster, and sf packages
library(tidyverse)
library(raster)
library(sf)

# Read the climate data from an rds file
climate <- readRDS("Datasets/climate_raster.rds")

# Have a look at the variables in the climate data
colnames(climate)

# Convert to SpatialPixelDataFrame for plotting
climate_df <- mutate(
  .data = climate, 
  rasters = map(
    .x = rasters, 
    ~ as_tibble(as(.x, "SpatialPixelsDataFrame")))) %>%
  unnest(cols = c(rasters))
Error in readRDS("Datasets/climate_raster.rds") : 
  ReadItem: unknown type 0, perhaps written by later version of R
#
Did you try infoRDS() ?  It **may** tell you something useful, though
it cannot tell you whether the file is corrupted or not. If you post
its results here, someone **may** be able to tell you something
informative.

That's all I got.

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sat, Sep 18, 2021 at 9:00 AM Jeff Reichman <reichmanj at sbcglobal.net> wrote:
#
$version
[1] 2

$writer_version
[1] "3.5.0"

$min_reader_version
[1] "2.3.0"

$format
[1] "xdr"

-----Original Message-----
From: Bert Gunter <bgunter.4567 at gmail.com> 
Sent: Saturday, September 18, 2021 11:40 AM
To: reichmanj at sbcglobal.net
Cc: R-help <R-help at r-project.org>
Subject: Re: [R] ReadItem: Error

Did you try infoRDS() ?  It **may** tell you something useful, though it cannot tell you whether the file is corrupted or not. If you post its results here, someone **may** be able to tell you something informative.

That's all I got.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sat, Sep 18, 2021 at 9:00 AM Jeff Reichman <reichmanj at sbcglobal.net> wrote: