Skip to content

Development version of units seems to fail with spaces in labels #297

@bart1

Description

@bart1

I was working with the development version the package. I seem to get error when i introduce spaces in labels, for both make_unit_label and plot and with ggplot. Either something is messed up in my system or it would be quite an annoying bug

require(units)
#> Loading required package: units
#> udunits database from /usr/share/xml/udunits/udunits2.xml
make_unit_label('s df',set_units(3,'Hz'))
#> Error in parse(text = str): <text>:1:3: unexpected symbol
#> 1: s df
#>       ^
d<-data.frame(a=set_units(1:5,'m'),b=set_units(5:1,'Hz')) 
plot(d$a, d$b, xlab='sd df')
#> Error in parse(text = str): <text>:1:4: unexpected symbol
#> 1: sd df
#>        ^
require(ggplot2)
#> Loading required package: ggplot2
ggplot(d, aes(a,b))+geom_point()+xlab('sa df')
#> Error in parse(text = str): <text>:1:4: unexpected symbol
#> 1: sa df
#>        ^
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=nl_NL.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggplot2_3.3.5 units_0.8-0  
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.8        pillar_1.6.4      compiler_4.1.2    highr_0.9        
#>  [5] R.methodsS3_1.8.1 R.utils_2.11.0    tools_4.1.2       digest_0.6.29    
#>  [9] evaluate_0.14     lifecycle_1.0.1   tibble_3.1.6      gtable_0.3.0     
#> [13] R.cache_0.15.0    pkgconfig_2.0.3   rlang_0.4.12      reprex_2.0.1     
#> [17] DBI_1.1.2         yaml_2.2.1        xfun_0.28         fastmap_1.1.0    
#> [21] dplyr_1.0.7       withr_2.4.3       styler_1.6.2      stringr_1.4.0    
#> [25] knitr_1.36        generics_0.1.1    fs_1.5.1          vctrs_0.3.8      
#> [29] tidyselect_1.1.1  grid_4.1.2        glue_1.6.0        R6_2.5.1         
#> [33] fansi_1.0.2       rmarkdown_2.11    farver_2.1.0      purrr_0.3.4      
#> [37] magrittr_2.0.1    backports_1.4.0   scales_1.1.1      ellipsis_0.3.2   
#> [41] htmltools_0.5.2   assertthat_0.2.1  colorspace_2.0-2  labeling_0.4.2   
#> [45] utf8_1.2.2        stringi_1.7.6     munsell_0.5.0     crayon_1.4.2     
#> [49] R.oo_1.24.0

Created on 2022-01-20 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions