[R-SIG-Mac] [External] summary() suddently producing weird NULL: values for factors and character attributes

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Tue Dec 15 00:35:17 CET 2020



> On 14 Dec 2020, at 23:07 , John Helly via R-SIG-Mac <r-sig-mac using r-project.org> wrote:
> 
> Aloha.
> 
> Don't know if this is uniquely a Mac issue or not.  I will try to test on a Linux distro later today.  \\\
> 
> In the meantime, here's the additional info.  Thanks for the responses.  I created a test subset of the input data so it is just the first DAUCO value subset (i.e., 00125).

Not likely Mac at all. In a reasonably clean session (on a Mac), I see

> dd <- structure(list(DAUCO = c("00125", "00125", "00125", "00125",
+ "00125", "00125"), Longitude = c(-121.416666667, -121.375, -121.333333333,
+ -121.291666667, -121.25, -121.208333333), Latitude = c(41.9583333334,
+ 41.9583333334, 41.9583333334, 41.9583333334, 41.9583333334, 41.9583333334
+ ), Precipitation = c(63.1469993591, 63.6969985962, 65.7460021973,
+ 69.4150009155, 74.0780029297, 80.4290008545), Year = c(1895,
+ 1895, 1895, 1895, 1895, 1895), Month = c(1, 1, 1, 1, 1, 1)), row.names = c(NA,
+ 6L), class = "data.frame")
> summary(dd)
    DAUCO             Longitude         Latitude     Precipitation  
 Length:6           Min.   :-121.4   Min.   :41.96   Min.   :63.15  
 Class :character   1st Qu.:-121.4   1st Qu.:41.96   1st Qu.:64.21  
 Mode  :character   Median :-121.3   Median :41.96   Median :67.58  
                    Mean   :-121.3   Mean   :41.96   Mean   :69.42  
                    3rd Qu.:-121.3   3rd Qu.:41.96   3rd Qu.:72.91  
                    Max.   :-121.2   Max.   :41.96   Max.   :80.43  
      Year          Month  
 Min.   :1895   Min.   :1  
 1st Qu.:1895   1st Qu.:1  
 Median :1895   Median :1  
 Mean   :1895   Mean   :1  
 3rd Qu.:1895   3rd Qu.:1  
 Max.   :1895   Max.   :1  

So do check that summary.data.frame in your setup is the original in namespace:base, and also that you don't have something defining a summary method for character vectors e.g. a summary.character function, but I suppose there could be a S4 method as well. 

-pd

> 
> In looking at the output of utils, perhaps there is some kind of inter-library conflict for summary?   Don't know how to look for multiple function names (yet).
> 
> J.
> 
> 
> * ====================================== R code and output ================================
> 
> PRISM        = read.table(PRISM_INPUT,header=TRUE, sep=',',
> colClasses=c('character','numeric','numeric','numeric','numeric','numeric'))
> ...
> 
> > dput(head(PRISM))
> structure(list(DAUCO = c("00125", "00125", "00125", "00125",
> "00125", "00125"), Longitude = c(-121.416666667, -121.375, -121.333333333,
> -121.291666667, -121.25, -121.208333333), Latitude = c(41.9583333334,
> 41.9583333334, 41.9583333334, 41.9583333334, 41.9583333334, 41.9583333334
> ), Precipitation = c(63.1469993591, 63.6969985962, 65.7460021973,
> 69.4150009155, 74.0780029297, 80.4290008545), Year = c(1895,
> 1895, 1895, 1895, 1895, 1895), Month = c(1, 1, 1, 1, 1, 1)), row.names = c(NA,
> 6L), class = "data.frame")
> >
> 
> 
> > utils::sessionInfo()
> R version 4.0.3 (2020-10-10)
> Platform: x86_64-apple-darwin17.0 (64-bit)
> Running under: macOS Catalina 10.15.7
> 
> Matrix products: default
> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods base
> 
> other attached packages:
> [1] reshape_0.8.8 plyr_1.8.6    ggplot2_3.3.2
> 
> loaded via a namespace (and not attached):
>  [1] Rcpp_1.0.4.6          pillar_1.4.4 DEoptimR_1.0-8        compiler_4.0.3        RColorBrewer_1.1-2
>  [6] iterators_1.0.12      digest_0.6.25 lifecycle_0.2.0       tibble_3.0.1          gtable_0.3.0
> [11] nlme_3.1-149          lattice_0.20-41 pkgconfig_2.0.3       rlang_0.4.6           foreach_1.5.0
> [16] Matrix_1.2-18         parallel_4.0.3 ergm_3.10.4           coda_0.19-3           withr_2.2.0
> [21] dplyr_1.0.0           generics_0.0.2 vctrs_0.3.1           networkDynamic_0.10.1 trust_0.1-8
> [26] grid_4.0.3            tidyselect_1.1.0 deSolve_1.28          robustbase_0.93-6     glue_1.4.1
> [31] R6_2.4.1              farver_2.0.3 purrr_0.3.4           magrittr_1.5          codetools_0.2-16
> [36] scales_1.1.1          ellipsis_0.3.1 MASS_7.3-53           lpSolve_5.6.15        colorspace_1.4-1
> [41] ape_5.4               labeling_0.3 network_1.16.0        lazyeval_0.2.2        doParallel_1.0.15
> [46] EpiModel_1.8.0        munsell_0.5.0 tergm_3.6.1           statnet.common_4.3.0  crayon_1.3.4
> >
> 
> On 12/13/20 18:22, Richard M. Heiberger wrote:
>> please send to the list the output from both:
>> 
>> dput(head(P2))
>> 
>> utils::sessionInfo()
>> 
>> This is the Macintosh list.  Is this specifically a Macintosh problem?
>> 
>> 
>> 
>> On Sun, Dec 13, 2020 at 6:32 PM John Helly via R-SIG-Mac <
>> r-sig-mac using r-project.org> wrote:
>> 
>>> Aloha.
>>> 
>>> For the past few weeks, maybe 6 or more, I've been getting strange results
>>> from the summary() function for data.frames.  Has anyone else noticed
>>> something like this?  I don't think I've done anything to cause this but
>>> cannot find anything to attribute it to.  Example below.  It lists every
>>> row as a value in the data frame attribute DAUCO.  Similar behavior found
>>> with other read.table results using syntax below.
>>> 
>>> 
>>> PRISM        =
>>> read.table(PRISM_INPUT,header=TRUE,stringsAsFactors=TRUE,sep=',',
>>> 
>>> colClasses=c('character','numeric','numeric','numeric','numeric','numeric'))
>>> 
>>> P2 is a subset of PRISM.
>>> 
>>> 
>>> 
>>> J.
>>> 
>>> --
>>> 
>>> John Helly, University of California, San Diego / San Diego Supercomputer Center / Scripps Institution of Oceanography / 760 840 8660 mobile / http://www.sdsc.edu/~hellyj
>>> ORCID ID: orcid.org/0000-0002-3779-0603
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac using r-project.org
>>> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mac__;!!Mih3wA!X3ALsWlGCDlXPERM1oTbCaxoruiXl51SE7N2G7ATqb9smiMNQuhwKEoi71_fCU8$
>>> 
> 
> -- 
> John Helly, University of California, San Diego / San Diego Supercomputer Center / Scripps Institution of Oceanography / 760 840 8660 mobile / http://www.sdsc.edu/~hellyj
> ORCID ID: orcid.org/0000-0002-3779-0603
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-SIG-Mac mailing list