benmarwick / smps

time series colour contour plots of data from Scanning Mobility Particle Sizer (SMPS) data
Other
7 stars 6 forks source link

smps_plot function Error #4

Open jiayuan-wang opened 5 years ago

jiayuan-wang commented 5 years ago

Hi Ben,

First of all, thank you so much for your great effort to make it possible to plot smps data in R! Really appreciate it!

Followed by your instruction, I have successfully installed the package, and prepared our data by the prepare function. However, when I try to plot the result by smps_plot function, I got this Error "Error: breaks and labels must have the same length". But there is no problem for plotting when I use your example data (my_data). Our data does have different size bins with your example data (my_data), so I am wondering if it is what causing the error. I attached some of our data below. Please let me know if you need any additional information on the problem. Thank you so much! test_data.csv.zip

benmarwick commented 5 years ago

Hello,

Thanks for your kind note! I have tried to reproduce your error, but it seems to work fine for me.

This is your data, right?

image

Here's what I did (do you have the latest version of the pkg?):

library(smps)  # v 0.2.2
jiayuan_wang <- readr::read_csv("test_data.csv")
jw_prepared_data <- prepare_data(jiayuan_wang)
smps_plot(jw_prepared_data) 

You might want to adjust the colour ramp to better highlight the regions of interest to you, and the x-axis scale to show more detail:

image

What code where you using?

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] smps_0.2.2

loaded via a namespace (and not attached):
  [1] Rcpp_1.0.0       rstudioapi_0.9.0 bindr_0.1.1      magrittr_1.5     hms_0.4.2       
[6] tidyselect_0.2.5 munsell_0.5.0    lattice_0.20-38  colorspace_1.4-0 R6_2.3.0        
[11] rlang_0.3.1      plyr_1.8.4       dplyr_0.7.8      tools_3.5.2      grid_3.5.2      
[16] gtable_0.2.0     digest_0.6.18    yaml_2.2.0       lazyeval_0.2.1   assertthat_0.2.0
[21] tibble_2.0.1     crayon_1.3.4     bindrcpp_0.2.2   akima_0.6-2      readr_1.3.1     
[26] tidyr_0.8.2      purrr_0.3.0      ggplot2_3.1.0    glue_1.3.0       labeling_0.3    
[31] sp_1.3-1         compiler_3.5.2   pillar_1.3.1     scales_1.0.0     pkgconfig_2.0.2 
jiayuan-wang commented 5 years ago

Hi Ben,

Thank you so much for your quick response and I really appreciate it!

Yes, you got my data right and I do use the latest version of your package. Well, I tested the partial data I sent you yesterday this morning (should do it before I sent you yesterday), and found out it does work fine. So I then test our whole dataset, and it gives me that error again ("Error: breaks and labels must have the same length"). Then, I tested our data by separating them into smaller chunks, and they all worked well surprisingly, the error will only comes out when using the whole dataset and I don't know why... It will be great If you can tell me what is causing this error (what does this error means?) and lead me to the right direction. Thank you so much for your help!

The whole dataset is attached below.

Here is what I did:

library(readr) test_data7 <- read_csv("test_data7.csv") prepared_testdata7 <- prepare_data(test_data7) smps_plot(prepared_testdata7) Error: breaks and labels must have the same length

Below is the code I am using:

sessionInfo() R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin18.0.0 (64-bit) Running under: macOS 10.14.2

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.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] smps_0.2.2 usethis_1.4.0 devtools_2.0.1 lubridate_1.7.4 readr_1.2.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.0 bindr_0.1.1 plyr_1.8.4 pillar_1.3.1 compiler_3.5.1
[6] prettyunits_1.0.2 remotes_2.0.2 tools_3.5.1 digest_0.6.18 pkgbuild_1.0.2
[11] pkgload_1.0.2 lattice_0.20-38 memoise_1.1.0 tibble_2.0.1 gtable_0.2.0
[16] pkgconfig_2.0.2 rlang_0.3.1 cli_1.0.1 rstudioapi_0.9.0 bindrcpp_0.2.2
[21] akima_0.6-2 dplyr_0.7.8 withr_2.1.2 stringr_1.3.1 desc_1.2.0
[26] fs_1.2.6 hms_0.4.2 tidyselect_0.2.5 rprojroot_1.3-2 grid_3.5.1
[31] glue_1.3.0 R6_2.3.0 processx_3.2.1 sessioninfo_1.1.1 sp_1.3-1
[36] tidyr_0.8.2 purrr_0.3.0 callr_3.1.1 ggplot2_3.1.0 magrittr_1.5
[41] scales_1.0.0 backports_1.1.3 ps_1.3.0 assertthat_0.2.0 colorspace_1.4-0 [46] labeling_0.3 stringi_1.2.4 lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4 test_data7.csv.zip