- attr(*, "problems")=<externalptr> explain please

I am not able to figure it out. I tried to google it, but I didn't get it.

That seems to be a normal feature of data frames read with readr::read_csv() and possibly other functions. You can get a data frame showing the detected read problems, if any, with the problems() function. Here is an example of reading in a csv file with no problems.

DF <- readr::read_csv("Dummy2.csv", )
Rows: 15 Columns: 2                                                         
── Column specification ──────────────────────────────────────────────────────
Delimiter: ","
chr (2): Name1, Name2

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

spec_tbl_df [15 × 2] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ Name1: chr [1:15] "rugby" "soccer" "basquet" "voley" ...
 $ Name2: chr [1:15] "sport1" "sport2" "sport1" "sport2" ...
 - attr(*, "spec")=
  .. cols(
  ..   Name1 = col_character(),
  ..   Name2 = col_character()
  .. )
 - attr(*, "problems")=<externalptr> 

# A tibble: 0 × 5
# … with 5 variables: row <int>, col <int>, expected <chr>, actual <chr>,
#   file <chr>
# ℹ Use `colnames()` to see all variable names

It's plumbing.

R generally holds everything in memory, but sometimes things don't fit. In that case, the externalptr attribute is set, which is a pointer object to a large binary object residing out of RAM somewhere. Like any other object in R (where everything is an object) it has properties. In this case it includes the attrPreformatted textibute problems that was set on the return from str(df1) possibly because df1 is a large object, already in memory, and another copy was made for the benefit of str(). Think of it like instructions to a courier driver to pick up a package from an address; the driver doesn't know what will be in the package.

The specific problem may have something to do with the class of df1, specifically its spec_tbl_df subclass. The following hocus pocus might work

class(df1) <- c("tbl_df", "tbl", "data.frame")

If you are reading this in from csv, go back and use read.csv in preference to readr::read_csv if that's what you did. That will avoid creating a tibble, giving just a data frame and will eliminate spc_tbl_df as a potential root cause of the problem. Ordinary users aren't supposed to know this kind of stuff.

1 Like

I really appreciate your pure intention of sharing knowledge with me. Thank you so much.

Thank Q for the input and for sharing your knowledge with me.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.