Closed hcyvan closed 6 years ago
From this error it appears order
or at least the sitting method is not
Unicode safe. I will have a look at the ordering mechanism, I do recall
there was a specific reason for the current sorting method.
Op vr 14 sep. 2018 07:20 schreef 程一航 notifications@github.com:
Report an Issue / Request a Feature
I'm submitting a (Check one with "x") :
- bug report
- feature request
Issue Severity Classification -
(Check one with "x") :
- 1 - Severe
- 2 - Moderate
- 3 - Low
Expected Behavior
load.project()
Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Munging data Running preprocessing script: 01-A.R Current Behavior
load.project()
Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Error in order(data.files$cache_only, data.files$filename, data.files$varname, : 参数长度不同 Steps to Reproduce Behavior
` mv ~/a.csv ./data
load.project() ` Screenshots Version Information Possible Solution
May be method='radix'
load.order <- order(data.files$cache_only, data.files$filename, data.files$varname, decreasing = c(TRUE, FALSE, FALSE), method = "radix")
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KentonWhite/ProjectTemplate/issues/277, or mute the thread https://github.com/notifications/unsubscribe-auth/AGn63__aLgxCbsctPa8lP22aB6cO6U1Vks5uazySgaJpZM4WoocS .
From this error it appears
order
or at least the sitting method is not Unicode safe. I will have a look at the ordering mechanism, I do recall there was a specific reason for the current sorting method. Op vr 14 sep. 2018 07:20 schreef 程一航 notifications@github.com: … Report an Issue / Request a Feature I'm submitting a (Check one with "x") : - bug report - feature request ------------------------------ Issue Severity Classification - (Check one with "x") : - 1 - Severe - 2 - Moderate - 3 - Low Expected Behavior load.project() Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Munging data Running preprocessing script: 01-A.R Current Behavior load.project() Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Error in order(data.files$cache_only, data.files$filename, data.files$varname, : 参数长度不同 Steps to Reproduce Behaviormv ~/a.csv ./data load.project()
Screenshots Version Information Possible Solution May be method='radix' load.order <- order(data.files$cache_only, data.files$filename, data.files$varname, decreasing = c(TRUE, FALSE, FALSE), method = "radix") — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#277>, or mute the thread https://github.com/notifications/unsubscribe-auth/AGn63__aLgxCbsctPa8lP22aB6cO6U1Vks5uazySgaJpZM4WoocS .
order(c(3,2,1), method='radix') have the same problem, However order(c(3,2,1)) works well
Thanks @Hugovdberg for looking into this. The documentation says that the default "auto" uses "radix" for short numeric vectors, integer vectors, logical vectors and factors. Otherwise it uses "shell". The biggest difference between "shell" and "radix" is that "radix" uses the local comparison. while "shell" uses a hard-coded comparison. This would give "shell" a slight performance boost for characters and why it was chosen. it also explains why it failed in this example. The Chinese character ordering is not defined in "shell" but radix uses the ordering for the location where it is defined.
I don't see any any obvious problem moving to "radix". In general, Project Template recommends starting each file with a number, so moving to radix shouldn't affect most projects.
Well it appears, there are two locations where the data is ordered, once within list.data
and once in .load.data
(part of load.project
). @hcyvan could you please call list.data()
to see if you get the error?
list.data
uses the auto method, while .load.data
specifies "radix".
Also, I cannot reproduce the error using this example:
order(c('3,1,2', '参数长度不同', 'abc'))
order(c('3,1,2', '参数长度不同', 'abc'), method="shell")
order(c('3,1,2', '参数长度不同', 'abc'), method="radix")
Could you please post your version of R, ProjectTemplate
and the operating system? And please report the result of Sys.getlocale(category = "LC_ALL")
, perhaps it is something different in our configurations that causes this error.
Thanks @KentonWhite and @Hugovdberg for your reply. According to your suggestion, I find that only one of my computer have this problem.
order(c('3,1,2', '参数长度不同', 'abc'), method="radix") # Can't work
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
locale:
[1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.2.3 base64enc_0.1-3 yaml_2.2.0 Rcpp_0.12.18
[9] stringi_1.2.4 rmarkdown_1.10 knitr_1.20 jsonlite_1.5 stringr_1.3.1 digest_0.6.16 evaluate_0.11
order(c('3,1,2', '参数长度不同', 'abc'), method="radix") # Works well
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0 yaml_2.1.19
I will check the order
problem then. :)
Thanks @KentonWhite and @Hugovdberg for your reply. According to your suggestion, I find that only one of my computer have this problem.
PC1:
order(c('3,1,2', '参数长度不同', 'abc'), method="radix") # Can't work
> sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.5 LTS locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8 [5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.2.3 base64enc_0.1-3 yaml_2.2.0 Rcpp_0.12.18 [9] stringi_1.2.4 rmarkdown_1.10 knitr_1.20 jsonlite_1.5 stringr_1.3.1 digest_0.6.16 evaluate_0.11
PC2
order(c('3,1,2', '参数长度不同', 'abc'), method="radix") # Works well
> sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 [2] LC_CTYPE=Chinese (Simplified)_China.936 [3] LC_MONETARY=Chinese (Simplified)_China.936 [4] LC_NUMERIC=C [5] LC_TIME=Chinese (Simplified)_China.936 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.0 tools_3.5.0 yaml_2.1.19
I will check the
order
problem then. :)
When I update R from 3.5 to 3.2, ProjectTemplate works well.
Report an Issue / Request a Feature
I'm submitting a (Check one with "x") :
Issue Severity Classification -
(Check one with "x") :
Expected Behavior
Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Munging data Running preprocessing script: 01-A.R
Current Behavior
Project name: pcNetwork Loading project configuration Autoloading packages Loading package: dplyr Loading package: stringr Autoloading helper functions Running helper script: globals.R Running helper script: helpers.R Autoloading data Error in order(data.files$cache_only, data.files$filename, data.files$varname, : 参数长度不同
Steps to Reproduce Behavior
` mv ~/a.csv ./data
load.project() `
Screenshots
Version Information
Possible Solution
May be method='radix'
load.order <- order(data.files$cache_only, data.files$filename, data.files$varname, decreasing = c(TRUE, FALSE, FALSE), method = "radix")