strengejacke / sjmisc

Data transformation and utility functions for R
https://strengejacke.github.io/sjmisc
GNU General Public License v3.0
157 stars 24 forks source link

descr() issues #41

Closed cschwem2er closed 7 years ago

cschwem2er commented 7 years ago

Sorry to bother you again with potential installation problems and version conflicts, but descr()still does not work for me after reinstalling the cran version of dplyr. Here is my sessionInfo():

R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] sjstats_0.7.0   sjPlot_2.1.2    sjmisc_2.1.0    dplyr_0.5.0     purrr_0.2.2     readr_1.0.0     tidyr_0.6.0     tibble_1.2     
 [9] ggplot2_2.2.0   tidyverse_1.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8        stringdist_0.9.4.2 mvtnorm_1.0-5      lattice_0.20-33    zoo_1.7-13         lmtest_0.9-34      assertthat_0.1    
 [8] digest_0.6.10      psych_1.6.9        mime_0.5           R6_2.2.0           plyr_1.8.4         stats4_3.3.0       coda_0.18-1       
[15] lazyeval_0.2.0     multcomp_1.4-6     minqa_1.2.4        nloptr_1.0.4       Matrix_1.2-6       DT_0.2             splines_3.3.0     
[22] lme4_1.1-12        stringr_1.1.0      foreign_0.8-66     htmlwidgets_0.8    munsell_0.4.3      shiny_0.14.2       broom_0.4.1       
[29] httpuv_1.3.3       modelr_0.1.0       mnormt_1.5-5       htmltools_0.3.5    nnet_7.3-12        coin_1.1-3         codetools_0.2-14  
[36] MASS_7.3-45        grid_3.3.0         nlme_3.1-127       arm_1.9-3          xtable_1.8-2       gtable_0.2.0       DBI_0.5-1         
[43] magrittr_1.5       scales_0.4.1       stringi_1.1.2      reshape2_1.4.2     effects_3.1-2      sandwich_2.3-4     blme_1.0-4        
[50] TH.data_1.0-7      tools_3.3.0        abind_1.4-5        parallel_3.3.0     survival_2.40-1    colorspace_1.3-1   knitr_1.15.1      
[57] haven_1.0.0        merTools_0.3.0     modeltools_0.2-21 

And here is the example with traceback:

d <- read_stata('GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta')
set.seed(339487731)
randgroup <- runif(nrow(d), min=0, max=1)
psych::describe(randgroup)

   vars    n mean   sd median trimmed  mad min max range  skew kurtosis   se
X1    1 2001  0.5 0.29   0.51     0.5 0.38   0   1     1 -0.01    -1.25 0.01

descr(randgroup)

Error in mutate_impl(.data, dots) : Unsupported type NILSXP for column "label"
13.
stop(structure(list(message = "Unsupported type NILSXP for column \"label\"", call = mutate_impl(.data, dots), cppstack = structure(list( file = "", line = -1L, stack = "C++ stack not available on this system"), .Names = c("file", "line", "stack"), class = "Rcpp_stack_trace")), .Names = c("message", ...
12.
mutate_impl(.data, dots)
11.
mutate_.tbl_df(.data, .dots = lazyeval::lazy_dots(...))
10.
mutate_(.data, .dots = lazyeval::lazy_dots(...))
9.
dplyr::mutate(., label = unname(get_label(dd, def.value = colnames(dd))))
8.
function_list[[i]](value)
7.
freduce(value, `_function_list`)
6.
`_fseq`(`_lhs`)
5.
eval(expr, envir, enclos)
4.
eval(quote(`_fseq`(`_lhs`)), env, env)
3.
withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
2.
tibble::as_tibble(psych::describe(dd)) %>% tibble::rownames_to_column(var = "variable") %>% dplyr::select_("-vars", "-mad") %>% dplyr::mutate(label = unname(get_label(dd, def.value = colnames(dd)))) %>% var_rename(median = "md")
1.
descr(randgroup)
sjPlot commented 7 years ago

Thanks, descr() did not work on unlabelled vectors. Unlabelled vectors only worked when argument in descr() was a data frame, and not a single vector.