-
Notifications
You must be signed in to change notification settings - Fork 8
/
R-World.Rmd
executable file
·1300 lines (1127 loc) · 42.2 KB
/
R-World.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "[<span style='color:goldenrod'>雷欧 ∪ 瑞欧,黄联富</span>](https://beta.rstudioconnect.com/content/3091/ryo-eng.html)"
subtitle: '个人简历'
author: "[雷欧 ∪ 瑞欧,黄联富](https://englianhu.github.io) <img src='文艺坊图库/ENG.png'
height='16' align='center' valign='middle'> <img src='文艺坊图库/me light mode.jpg'
height='16' align='center' valign='middle'>®"
tags: [计量经济学, 量化圈, 娱乐圈, ®, Python, ®Studio]
date: '22-Oct-1984'
output:
html_document:
mathjax: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
number_sections: yes
highlight: haddock
toc: yes
toc_depth: 6
toc_float:
collapsed: yes
smooth_scroll: yes
code_folding: hide
css: CSSBackgrounds.css
fig_caption: yes
word_document:
mathjax: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
number_sections: yes
highlight: haddock
self_contained: no
theme: lumen
toc: yes
toc_depth: 6
toc_float:
collapsed: yes
smooth_scroll: yes
code_folding: hide
css: CSSBackgrounds.css
pdf_document:
mathjax: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
number_sections: yes
highlight: haddock
self_contained: no
theme: lumen
toc: yes
toc_depth: 6
toc_float:
collapsed: yes
smooth_scroll: yes
code_folding: hide
css: CSSBackgrounds.css
always_allow_html: yes
resource_files:
- 文艺坊图库/188bet.jpg
- 文艺坊图库/20160910_121813.gif
- 文艺坊图库/360doc.jpeg
- 文艺坊图库/7live.jpg
- 文艺坊图库/7live_36x36.jpg
- 文艺坊图库/aaa1.jpg
- 文艺坊图库/aaa2.jpg
- 文艺坊图库/aaaa.jpg
- 文艺坊图库/aboutme.jpg
- 文艺坊图库/aboutme_36x36.jpg
- 文艺坊图库/academia.jpg
- 文艺坊图库/AIA.png
- 文艺坊图库/ali.jpg
- 文艺坊图库/ali_36x36.jpg
- 文艺坊图库/alibaba1.jpg
- 文艺坊图库/alibaba2.jpg
- 文艺坊图库/anr.jpg
- 文艺坊图库/anr_36x36.jpg
- 文艺坊图库/apple.jpg
- 文艺坊图库/Arduino.png
- 文艺坊图库/AskUbuntu.png
- 文艺坊图库/bettingforum.jpg
- 文艺坊图库/bettingforum_36x36.jpg
- 文艺坊图库/betworks.jpg
- 文艺坊图库/BiliBili.png
- 文艺坊图库/biostatistic.jpg
- 文艺坊图库/biostatistic_36x36.jpg
- 文艺坊图库/bitbucket.jpg
- 文艺坊图库/bitbucket_36x36.jpg
- 文艺坊图库/cari.png
- 文艺坊图库/caspo.jpg
- 文艺坊图库/centOS.jpg
- 文艺坊图库/centOS_36x36.jpg
- 文艺坊图库/Chris_Evans_Captain_America.jpg
- 文艺坊图库/cos.jpg
- 文艺坊图库/cos_36x36.jpg
- 文艺坊图库/coursera.jpg
- 文艺坊图库/coursera_36x36.jpg
- 文艺坊图库/csdn.jpg
- 文艺坊图库/csdn_36x36.jpg
- 文艺坊图库/csdn2.png
- 文艺坊图库/dashencaicai2.jpg
- 文艺坊图库/discord1.jpg
- 文艺坊图库/discord2.jpg
- 文艺坊图库/Discuss.png
- 文艺坊图库/disqus.jpg
- 文艺坊图库/disqus_36x36.jpg
- 文艺坊图库/DouYin.png
- 文艺坊图库/dwang.jpg
- 文艺坊图库/dwang_36x36.jpg
- 文艺坊图库/dwang2.png
- 文艺坊图库/Dynasty_Hotel_Tang.png
- 文艺坊图库/ENG.png
- 文艺坊图库/Esquire_Kitchen.png
- 文艺坊图库/facebook.jpg
- 文艺坊图库/facebook_36x36.jpg
- 文艺坊图库/facebook2.jpg
- 文艺坊图库/facebook2_36x36.jpg
- 文艺坊图库/FB.jpeg
- 文艺坊图库/FossCom1.png
- 文艺坊图库/FossCom2.png
- 文艺坊图库/fuji-xerox.jpg
- 文艺坊图库/gblinks.JPG
- 文艺坊图库/getronics.png
- 文艺坊图库/github.jpg
- 文艺坊图库/github_36x36.jpg
- 文艺坊图库/github2.jpg
- 文艺坊图库/github2_36x36.jpg
- 文艺坊图库/github3.jpg
- 文艺坊图库/github3_36x36.jpg
- 文艺坊图库/Github_Pages.png
- 文艺坊图库/Golden-Royal.png
- 文艺坊图库/gplus.jpg
- 文艺坊图库/gplus_36x36.jpg
- 文艺坊图库/guokr.jpeg
- 文艺坊图库/HKUST.png
- 文艺坊图库/hong.jpg
- 文艺坊图库/hot.jpg
- 文艺坊图库/idealseed.jpg
- 文艺坊图库/IG1.png
- 文艺坊图库/IG2.png
- 文艺坊图库/IG3.png
- 文艺坊图库/IG4.png
- 文艺坊图库/IG5.png
- 文艺坊图库/Illinois.jpg
- 文艺坊图库/instagram.jpg
- 文艺坊图库/instagram_36x36.jpg
- 文艺坊图库/instagram2.jpg
- 文艺坊图库/instagram2_36x36.jpg
- 文艺坊图库/instagram3.jpg
- 文艺坊图库/instagram3_36x36.jpg
- 文艺坊图库/InventKDE1.jpeg
- 文艺坊图库/InventKDE2.png
- 文艺坊图库/iq.png
- 文艺坊图库/jckl.png
- 文艺坊图库/JEES.gif
- 文艺坊图库/JFKL.jpg
- 文艺坊图库/jg.jpg
- 文艺坊图库/jg_36x36.jpg
- 文艺坊图库/JG1.png
- 文艺坊图库/JG2.png
- 文艺坊图库/jhu.jpg
- 文艺坊图库/JianShu.png
- 文艺坊图库/joey_jeans.jpg
- 文艺坊图库/KuaiShou.png
- 文艺坊图库/ladbrokes.jpg
- 文艺坊图库/library.jpg
- 文艺坊图库/library2.jpg
- 文艺坊图库/library3.jpg
- 文艺坊图库/linkedin.jpg
- 文艺坊图库/linkedin_36x36.jpg
- 文艺坊图库/linkedIn.jpeg
- 文艺坊图库/LinuxConfig1.jpg
- 文艺坊图库/LinuxConfig2.png
- 文艺坊图库/LQ.jpg
- 文艺坊图库/LQ_36x36.jpg
- 文艺坊图库/LQ2.jpg
- 文艺坊图库/LQ2_36x36.jpg
- 文艺坊图库/ltree.png
- 文艺坊图库/madio.png
- 文艺坊图库/manpower.jpg
- 文艺坊图库/mas.jpg
- 文艺坊图库/math & stats.jpg
- 文艺坊图库/math-3d-hd-wallpaper.jpg
- 文艺坊图库/math-theme-03.jpg
- 文艺坊图库/mathchina.jpg
- 文艺坊图库/mathchina_36x36.jpg
- 文艺坊图库/maths.jpg
- 文艺坊图库/MClub.png
- 文艺坊图库/Me byteDance.jpg
- 文艺坊图库/me light mode.jpg
- 文艺坊图库/me.JPG
- 文艺坊图库/me light mode.jpg
- 文艺坊图库/medium.png
- 文艺坊图库/mindpearl01.jpg
- 文艺坊图库/mindpearl02.jpg
- 文艺坊图库/my-passport-size-photo.jpg
- 文艺坊图库/no-sex-at-the-moment.png
- 文艺坊图库/NYIF.jpeg
- 文艺坊图库/NYU.png
- 文艺坊图库/nyu.png
- 文艺坊图库/oda-army.jpg
- 文艺坊图库/OKru.png
- 文艺坊图库/oksportcn_01.png
- 文艺坊图库/oksportcn_02.png
- 文艺坊图库/oksportcn_03.png
- 文艺坊图库/oksportcn_04.png
- 文艺坊图库/Orchard.jpg
- 文艺坊图库/PAAC.jpg
- 文艺坊图库/Peking University 02.png
- 文艺坊图库/phabricator.png
- 文艺坊图库/pixnet.jpeg
- 文艺坊图库/plotly.jpg
- 文艺坊图库/plotly_36x36.jpg
- 文艺坊图库/PLounge.jpg
- 文艺坊图库/PLounge_36x36.jpg
- 文艺坊图库/prestige.png
- 文艺坊图库/qi-pioneer-logo.png
- 文艺坊图库/QQ wb.jpg
- 文艺坊图库/QQ wb_36x36.jpg
- 文艺坊图库/QQ.jpg
- 文艺坊图库/QQ_36x36.jpg
- 文艺坊图库/qi-pioneer-logo.png
- 文艺坊图库/quant_trader_adj.jpg
- 文艺坊图库/quantitative trader.jpg
- 文艺坊图库/quantitative trader 1.jpg
- 文艺坊图库/quantitative trader 2.jpg
- 文艺坊图库/quantitative_trader.jpg
- 文艺坊图库/Quora.jpg
- 文艺坊图库/Qzone.jpg
- 文艺坊图库/Qzone_36x36.jpg
- 文艺坊图库/RB.png
- 文艺坊图库/rcrown.jpg
- 文艺坊图库/Reddit.png
- 文艺坊图库/retailsshop.jpg
- 文艺坊图库/RG.png
- 文艺坊图库/rnable.jpg
- 文艺坊图库/rnable_36x36.jpg
- 文艺坊图库/rstudio.jpg
- 文艺坊图库/RStudioCom1.png
- 文艺坊图库/RStudioCom2.png
- 文艺坊图库/RT1.jpg
- 文艺坊图库/RT2.jpg
- 文艺坊图库/RT3.jpg
- 文艺坊图库/RXforum.jpg
- 文艺坊图库/RXforum_36x36.jpg
- 文艺坊图库/RYO-Photo.jpg
- 文艺坊图库/RYO.jpg
- 文艺坊图库/RYU.jpg
- 文艺坊图库/SBR.jpg
- 文艺坊图库/SBR_36x36.jpg
- 文艺坊图库/Scibrokes.png
- 文艺坊图库/scb_logo.jpg
- 文艺坊图库/scb_logo2.jpg
- 文艺坊图库/scb-logo3.jpg
- 文艺坊图库/scb-logo3rs.jpg
- 文艺坊图库/Scibrokes®-TonyStark®.jpg
- 文艺坊图库/Scibrokes-TonyStark.png
- 文艺坊图库/scicom.jpg
- 文艺坊图库/SE.png
- 文艺坊图库/ShirotoNorimichi.jpg
- 文艺坊图库/ShirotoNorimichi2.jpg
- 文艺坊图库/skype.jpg
- 文艺坊图库/skype_36x36.jpg
- 文艺坊图库/social.jpg
- 文艺坊图库/social_36x34.jpg
- 文艺坊图库/SocialMedia.jpg
- 文艺坊图库/SOF.jpg
- 文艺坊图库/starlizard.jpg
- 文艺坊图库/stats.jpg
- 文艺坊图库/Steam.jpeg
- 文艺坊图库/talkstats.jpg
- 文艺坊图库/talkstats_36x36.jpg
- 文艺坊图库/TARC.jpg
- 文艺坊图库/telebiz.jpg
- 文艺坊图库/Thumbs.db
- 文艺坊图库/tm.jpg
- 文艺坊图库/TonyStark.png
- 文艺坊图库/tsujiki-mart.png
- 文艺坊图库/Tumblr.png
- 文艺坊图库/Tumblr1.png
- 文艺坊图库/Tumblr2.jpeg
- 文艺坊图库/Tumblr3.jpg
- 文艺坊图库/twitter.jpg
- 文艺坊图库/twitter_36x36.jpg
- 文艺坊图库/u-drive-media.jpg
- 文艺坊图库/u-of-i-urbana-2.png
- 文艺坊图库/UCSC.jpeg
- 文艺坊图库/ucsc.jpg
- 文艺坊图库/um.jpg
- 文艺坊图库/UoP-logo.jpg
- 文艺坊图库/UST.jpg
- 文艺坊图库/uwants.png
- 文艺坊图库/vimeo.jpg
- 文艺坊图库/vk.png
- 文艺坊图库/Wechat.jpeg
- 文艺坊图库/Wechat1.png
- 文艺坊图库/Wechat2.png
- 文艺坊图库/weibo.jpg
- 文艺坊图库/weibo_36x36.jpg
- 文艺坊图库/wordpress.jpg
- 文艺坊图库/wordpress_36x36.jpg
- 文艺坊图库/Wechat1.png
- 文艺坊图库/Wechat2.png
- 文艺坊图库/xerox.jpg
- 文艺坊图库/xueba.jpg
- 文艺坊图库/xueba1.jpg
- 文艺坊图库/xueba2.jpg
- 文艺坊图库/xueba2.png
- 文艺坊图库/xueba3.jpg
- 文艺坊图库/Yandex.png
- 文艺坊图库/YouTube.jpeg
- 文艺坊图库/zeef.jpg
- 文艺坊图库/zeef_36x36.jpg
- 文艺坊图库/ZhiHu.png
- 文艺坊图库/zoom.jpeg
- 文艺坊图库/βεst Jοεγ 7.jpg
- 文艺坊图库/βεst Jοεγ 8.jpg
- 文艺坊图库/βεst Jοεγ 胸有大痣.png
- 文艺坊图库/βεst Jοεγ.jpg
- 文艺坊图库/中国区划.gif
- 文艺坊图库/美国省区旗.png
- 文艺坊图库/βεst Jοεγ 胸有大痣.png
- 文艺数据库/dfm.csv
- 文艺数据库/kellym.txt
- 文艺数据库/shinyData.rds
- 文艺数据库/worldcities.csv
- 函数/buildFund.R
- 函数/libs.R
- 函数/plotChart.R
- 文艺坊曲库/bigmoney.mp3
- 文艺坊图库/b4TDbiz-.pdf
- 文艺坊图库/韩国情信.mp4
- 博物院/Coursera Illinous - Data Mining - 01 Data Visualization.pdf
- 博物院/Coursera Illinous - Data Mining - 02 Text Retrieval and Search Engines.pdf
- 博物院/Coursera Illinous - Data Mining - 03 Text Mining and Analytics.pdf
- 博物院/Coursera Illinous - Improving Business Finances and Operations - 02 Managerial
Accounting - Tools for Facilitating and Guiding Business Decisions.pdf
- 博物院/Coursera Illinous - Improving Business Finances and Operations - 04 Financial
Evaluation and Strategy - Corporate Finance.pdf
- 博物院/Coursera Illinous - Improving Business Finances and Operations - 05 Operations
Management.pdf
- 博物院/Coursera Johns Hopkins - 01 Data Science Toolbox 2014.pdf
- 博物院/Coursera Johns Hopkins - 02 R Programming.pdf
- 博物院/Coursera Johns Hopkins - 03 Getting and Cleaning Data 2014.pdf
- 博物院/Coursera Johns Hopkins - 04 Exploratory Data Analysis.pdf
- 博物院/Coursera Johns Hopkins - 05 Reproducible Research.pdf
- 博物院/Coursera Johns Hopkins - 06 Statistical Inference.pdf
- 博物院/Coursera Johns Hopkins - 07 Regression Models.pdf
- 博物院/Coursera Johns Hopkins - 08 Pratical Machine Learning.pdf
- 博物院/Coursera Johns Hopkins - 09 Develeoping Data Products.pdf
- 博物院/Coursera Johns Hopkins - 10 Data Science Capstone.pdf
- 博物院/Coursera Johns Hopkins - 11 Completed 10 Courses in Data Science.pdf
- 博物院/Coursera Michigan - Programming for Everybody (Python).pdf
- 博物院/DataCamp - Data Analysis and Statistical Inference.pdf
- 博物院/DataCamp - Intro to Computational Finance with R.pdf
- 博物院/DataCamp - Introduction to R.pdf
- 博物院/DataCamp - Kaggle R Tutorial on Machine Learning.pdf
- 博物院/Google Analytics.pdf
- 博物院/JLPT Certificate.jpg
- 博物院/Scicom Appreciation Certificate.jpg
- 博物院/Scicom CS Workshop.jpg
- 博物院/SPM Certificate.jpg
- 博物院/Ryo Eng_Introduction to Machine Learning for Trading_certificate.pdf
- 博物院/Ryo Eng_Quantitative Trading Strategies and Models_certificate.pdf
- 博物院/Ryo, Eng Lian Hu_Trading using Options Sentiment Indicators_certificate.pdf
- 博物院/Coursera JHU 01 - The R Programming Environment.pdf
- 博物院/Coursera JHU 02 - Advanced R Programming.pdf
- 博物院/Coursera JHU 03 - Building R Packages.pdf
- 博物院/Coursera JHU 04 - Building Data Visualization Tools.pdf
- 博物院/Coursera JHU 05 - Mastering Software Development in R Capstone.pdf
- 博物院/Coursera NYU - Overview of Advanced Methods of Reinforcement Learning in Finance.pdf
- 博物院/Coursera Peking - Bioinformatics - Hidden Markov Models (生物信息学 - 隐马尔科夫链).pdf
- 博物院/Coursera California - Bayesian Statistics Mixture Models.pdf
- 文艺坊曲库/小松拓也 - 不知道方向 Takuya Komatsu (原创) - (Better Ownself).mp3
runtime: shiny
---
# 设定
## SCSS 设置
<style>
pre {
overflow-x: auto;
}
pre code {
word-wrap: normal;
white-space: pre;
}
.table-hover > tbody > tr:hover {
background-color: #8D918D;
}
</style>
```{r load-sass, class.source='bg-success', class.output='bg-primary'}
# install.packages('remotes', dependencies = TRUE, INSTALL_opts = '--no-lock')
library('BBmisc', 'rmsfuns')
#remotes::install_github("rstudio/sass")
lib('sass')
## https://support.rstudio.com/hc/en-us/articles/200532197
## https://community.rstudio.com/t/r-does-not-display-korean-chinese/30889/3?u=englianhu
#Sys.setlocale("LC_CTYPE", "en_US.UTF-8")
#Sys.setlocale("LC_CTYPE", "zh_CN.UTF-8")
#Sys.setlocale(category = "LC_CTYPE", "Chinese (Simplified)_China.936")
#Sys.setlocale(locale = "Chinese")
#Sys.setlocale(locale = "Japanese")
#Sys.setlocale(locale = "English")
# rmarkdown::render('/home/englianhu/Documents/owner/ryo-cn.Rmd', encoding = 'UTF-8')
#Sys.setlocale("LC_CTYPE", "UTF-8")
#Sys.setlocale(locale = "UTF-8")
#Sys.setlocale(category = "LC_ALL", locale = "chs")
#Sys.setlocale(category = "LC_ALL", locale = "UTF-8")
#Sys.setlocale(category = "LC_ALL", locale = "Chinese")
#Sys.setlocale(category = "LC_ALL", locale = "zh_CN.UTF-8")
Sys.setlocale("LC_ALL", "en_US.UTF-8")
```
```{scss set-scss, class.source='bg-success', class.output='bg-primary'}
/* https://stackoverflow.com/a/66029010/3806250 */
h1 { color: #002C54; }
h2 { color: #2F496E; }
h3 { color: #375E97; }
h4 { color: #556DAC; }
h5 { color: #92AAC7; }
/* ----------------------------------------------------------------- */
/* https://gist.github.com/himynameisdave/c7a7ed14500d29e58149#file-broken-gradient-animation-less */
.hover01 {
/* color: #FFD64D; */
background: linear-gradient(155deg, #EDAE01 0%, #FFEB94 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #EDAE01 20%, #FFEB94 80%);
}
}
.hover02 {
color: #FFD64D;
background: linear-gradient(155deg, #002C54 0%, #4CB5F5 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #002C54 20%, #4CB5F5 80%);
}
}
.hover03 {
color: #FFD64D;
background: linear-gradient(155deg, #A10115 0%, #FF3C5C 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #A10115 20%, #FF3C5C 80%);
}
}
```
```{r gb-opts, class.source='hover01', class.output='hover02'}
## Set the timezone but not change the datetime
Sys.setenv(TZ = 'Asia/Shanghai')
## Setting to omit all warnings
## https://stackoverflow.com/a/36846793/3806250
## Set width
## options(knitr.table.format = 'html') will set all kableExtra tables to be 'html', otherwise need to set the parameter on every single table.
options(warn = -1, width = 999, knitr.table.format = 'html')#, digits.secs = 6)
## https://stackoverflow.com/questions/39417003/long-vectors-not-supported-yet-abnor-in-rmd-but-not-in-r-script
## https://yihui.org/knitr/options
knitr::opts_chunk$set(
class.source = 'hover01', class.output = 'hover02', class.error = 'hover03',
message = FALSE, warning = FALSE, error = TRUE,
autodep = TRUE, aniopts = 'loop',
progress = TRUE, verbose = TRUE,
cache = FALSE, cache.lazy = FALSE, result = 'asis')
```
<br><br>
## 设置
```{r libs, eval=FALSE}
## Setup Options, Loading Required Libraries and Preparing Environment
## Loading the packages and setting adjustment
source('函数/libs.R')
```
```{r set, include=FALSE}
## Setup Options, Loading Required Libraries and Preparing Environment
## Loading the package 'BBmisc'
if(suppressMessages(!require('BBmisc'))){
install.packages('BBmisc', dependencies = TRUE, INSTALL_opts = '--no-lock')
suppressMessages(library('BBmisc'))
}
if (suppressMessages(!require('rmsfuns'))) {
install.packages('rmsfuns', dependencies = TRUE, INSTALL_opts = '--no-lock')
suppressMessages(library('rmsfuns'))
}
if(!require('REmap')) devtools::install_github('lchiffon/REmap')
## Loading multiple packages at once
pkgs <- c('readr', 'plyr', 'dplyr', 'magrittr', 'tidyverse', 'devtools', 'zoo', 'lubridate', 'stringr', 'rvest', 'markdown', 'googleVis', 'knitr', 'rmarkdown', 'htmltools', 'knitr', 'kableExtra', 'formattable', 'echarts4r', 'radarchart', 'MASS', 'htmlwidgets', 'REmap', 'ggmap', 'vembedr', 'maps', 'maptools', 'conflicted')
suppressAll(lib(pkgs))
load_pkg(pkgs)
rm(pkgs)
conflict_prefer('mutate', 'dplyr')
conflict_prefer('rename', 'dplyr')
conflict_prefer('filter', 'dplyr')
conflict_prefer('select', 'dplyr')
conflict_prefer('layout', 'plotly')
## Set the googleVis options first to change the behaviour of plot.gvis, so that
## only the chart component of the HTML file is written into the output file.
op <- options(gvis.plot.tag = 'chart')
## <audio src='文艺坊曲库/bigmoney.mp3' autoplay controls loop></audio>
```
```{r, error = TRUE, results='asis'}
#remotes::install_git("https://gitee.com/JohnCoene/echarts4r")
lib('echarts4r')
mtcars |>
e_charts(disp) |>
e_scatter(mpg, qsec) |>
e_loess(mpg ~ disp)
iris |>
group_by(Species) |>
e_charts(Sepal.Length) |>
e_line(Sepal.Width) |>
e_lm(Sepal.Width ~ Sepal.Length) |>
e_x_axis(min = 4)
df <- data.frame(
x = seq(50),
y = rnorm(50, 10, 3),
z = rnorm(50, 11, 2),
w = rnorm(50, 9, 2)
)
df |>
e_charts(x) |>
e_line(z) |>
e_area(w) |>
e_title("Line and area charts")
df |>
e_charts(x) |>
e_polar() |>
e_angle_axis(x) |> # angle = x
e_radius_axis() |>
e_bar(y, coord_system = "polar") |>
e_scatter(z, coord_system = "polar")
df |>
head(10) |>
e_charts(x) |>
e_polar() |>
e_angle_axis() |>
e_radius_axis(x) |>
e_bar(y, coord_system = "polar") |>
e_scatter(z, coord_system = "polar")
df <- data.frame(
x = LETTERS[1:5],
y = runif(5, 1, 5),
z = runif(5, 3, 7)
)
df |>
e_charts(x) |>
e_radar(y, max = 7, name = "radar") |>
e_radar(z, max = 7, name = "chart") |>
e_tooltip(trigger = "item")
```
```{r skill, error = TRUE, message = FALSE, warning = FALSE, echo = FALSE, result = 'asis'}
require('dplyr', quietly = TRUE, warn.conflicts = FALSE)
require('magrittr', quietly = TRUE, warn.conflicts = FALSE)
require('formattable', quietly = TRUE, warn.conflicts = FALSE)
require('knitr', quietly = TRUE, warn.conflicts = FALSE)
require('kableExtra', quietly = TRUE, warn.conflicts = FALSE)
conflict_prefer('filter', 'dplyr')
conflict_prefer('layout', 'plotly')
conflict_prefer('select', 'dplyr')
skill <- tibble(
'技能' = c('计量经济学', '量化交易', '®编程', '微软办公软件', 'SQL语言', '派森编程语言', '数据分析', '客服工作', '体育博彩行业', '建立®Studio服务器', '统计学', '数据科学', '闪霓应用', '李呢克斯🐧操作系统', '网页应用程序接口', 'Sparklyr大数据分析', '量化分析', '高级®编程', 'modeltime / tidyverts / prophet', 'tidyverse / tidymodels', '张量Tensorflow / Pytorch', '浏览器驱动', 'FrontPage / 部署网站', 'Photoshop / Picsart'),
'程度' = c(9, 9, 9, 8, 3, 4, 9, 9, 7, 7, 6, 8, 8, 7, 6, 2, 8, 6, 7, 6, 2, 4, 3, 5))
skill <- tibble('序列' = 1:nrow(skill), skill)
skill |>
{\(.) dplyr::mutate(
., `技能` = cell_spec(`技能`, italic = TRUE,
color = spec_color(seq(nrow(skill)), option = 'A',
begin = 0.1, end = 0.9),
tooltip = paste0('程度: ', `程度`), angle = 3))}() |>#,
#Level = color_tile('#FFFDDC', 'darkgoldenrod')(Level)) |>
{\(.) mutate_if(., is.numeric, function(x){
cell_spec(x, 'html', color =
spec_color(x, option = 'A', begin = 0.1, end = 0.9,
direction = -1), angle = 20,
font_size = spec_font_size(x), bold = TRUE) })}() |>
{\(.) kbl(., caption = '技能评估(从新兵1至专业10)', escape = FALSE, align = 'c')}() |>
{\(.) kable_styling(., bootstrap_options = c('striped', 'hover', 'condensed', 'responsive'))}() |>
{\(.) row_spec(., 0, background = 'DimGrey', color = 'yellow')}()# %>%
#column_spec(1, background = 'CornflowerBlue', color = 'red') %>%
#column_spec(2, background = 'grey', color = 'black') %>%
#column_spec(2, background = 'grey', color = 'black')
```
```{r skill2B, error = TRUE, message = FALSE, warning = FALSE, echo = FALSE, result = 'asis'}
#radarchart::chartJSRadar(
# skill[,-1], main = 'Skill Rating', width = '100%', height = '100%',
# maxScale = 10, labelSize = 'auto', showToolTipLabel = TRUE)
### ---------------------------
linear_gradient1 <- htmlwidgets::JS(
"new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: '#EDAE01' },
{ offset: 1, color: '#FFEB94' }
])")
linear_gradient2 <- htmlwidgets::JS(
"new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: '#002C54' },
{ offset: 1, color: '#4CB5F5' }
])")
skill |>
echarts4r::e_charts(`技能`) |>
echarts4r::e_radar(`程度`, max = 10, name = skill$`技能`,
itemStyle = list(
color = linear_gradient1),
areaStyle = list(
color = linear_gradient2)) |>
echarts4r::e_tooltip(trigger = 'item')
```
```{r REmap-set1, echo=FALSE}
## Reinitialized the REmap setting
remap.init()
```
```{r read-data, echo=FALSE}
## Set a data frame format cities and randomly set country code
data = data.frame(country=mapNames('world'), value=5*sample(178)+200)
vec = c('Beijing','Tokyo','Shanghai','New York','Sydney','London','Bangkok',
'Taipei','Moscow','Washington','Lyon','Milan','Rome','Macao',
'Singapore','Hong Kong','Kuala Lumpur','Madrid','Geneva','Paris',
'Melbourne','Boston','Washington','Liverpool','Brighton','Bali',
'San Francisco','Jakarta','Ho Chi Minh','Brasilia','Barcelona',
'Rio de Janeiro','Buenos Aires','Bern','Basel','Zurich','Manila',
'Toronto','Vancouver','Budapest','New Delhi','Thimphu','Mumbai',
'Cairo','Greater Johannesburg','Durban','Alexandria','Zaria','Dubai',
'Istanbul','Mexico City','Sapporo','Osaka','Ulaanbaatar','Vienna')
## Get world city geocode by ggmap
#geodata = suppressAll(as.data.frame(cbind(ggmap::geocode(vec),vec)))
## Get world city geocode from simplemaps.com
## https://simplemaps.com/data/world-cities
geodata <- readr::read_csv('文艺数据库/worldcities.csv', show_col_types = FALSE) |>
dplyr::filter(capital %in% c('primary', 'admin')) |>
dplyr::select(lng, lat, country, city) |>
dplyr::rename(lon = lng) |>
dplyr::mutate(lon = round(lon, 3))
countries <- geodata$country |>
unique()
## randomly set country codes
data <- data.frame(
country = countries,
value = 5 * sample(length(countries)) + 200)
## cities
#vec <- geodata$city
## lon & lat of cities
geodata <- geodata |>
data.frame() |>
dplyr::select(lon, lat, city) |>
dplyr::rename(vec = city)
## Design a line data frame
#markLinedata <- data.frame(
# origin = rep('Beijing', (length(vec) - 1)),
# destination = geodata$vec[!geodata$vec %in% 'Beijing'])
## Design a line data.frame
markLinedata = data.frame(origin = rep('Beijing', 54), destination = vec[-1])
```
```{r plot-map, echo=FALSE}
## Plot the REmap shining
p <- remapC(data, maptype = 'world', color = c('black', 'black'),
theme = get_theme(backgroundColor = 'black'),
markPointData = vec, markLineData = markLinedata, geoData = geodata)
knitrREmap(p, local = FALSE)
```
<iframe width='100%' height='450' scrolling='no' frameborder='no' src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/221986532&auto_play=true&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe>
```{r REmap-set2, echo=FALSE}
## Reinitialized the REmap setting
remap.init()
geodata <- maps::world.cities |>
dplyr::rename(city = name, country = country.etc, lon = long) |>
dplyr::select(country, city, capital, lon, lat, pop) |>
dplyr::filter(capital == 1)
countries <- geodata$country |>
unique()
## randomly set country codes
data <- data.frame(
country = countries,
value = 5 * sample(length(countries)) + 200)
## cities
#vec <- geodata$city
## lon & lat of cities
geodata <- geodata |>
data.frame() |>
dplyr::select(lon, lat, city) |>
dplyr::rename(vec = city)
## Design a line data frame
#markLinedata <- data.frame(
# origin = rep('Beijing', (length(vec) - 1)),
# destination = geodata$vec[!geodata$vec %in% 'Beijing'])
## Design a line data.frame
markLinedata = data.frame(origin = rep('Beijing', 54), destination = vec[-1])
## Plot the REmap shining
p <- remapC(data, maptype = 'world', color = c('black', 'black'),
theme = get_theme(backgroundColor = 'black'),
markPointData = vec, markLineData = markLinedata, geoData = geodata)
knitrREmap(p, local = FALSE)
```
```{r, error = TRUE, results='asis'}
# Library
lib('fmsb')
# Create data: note in High school for Jonathan:
data <- as.data.frame(matrix(sample(2:20, 10, replace = TRUE), ncol = 10))
colnames(data) <- c('math', 'english', 'biology', 'music', 'R-coding', 'data-viz', 'french', 'physic', 'statistic', 'sport')
# To use the fmsb package, I have to add 2 lines to the dataframe: the max and min of each topic to show on the plot!
data <- rbind(rep(20, 10), rep(0,10), data)
# Check your data, it has to look like this!
# head(data)
# The default radar chart
radarchart(data)
# Create data: note in High school for Jonathan:
data <- as.data.frame(matrix(sample(2:20, 10, replace = TRUE), ncol = 10))
colnames(data) <- c('math', 'english', 'biology', 'music', 'R-coding', 'data-viz', 'french', 'physic', 'statistic', 'sport')
# To use the fmsb package, I have to add 2 lines to the dataframe: the max and min of each topic to show on the plot!
data <- rbind(rep(20, 10), rep(0, 10), data)
# Check your data, it has to look like this!
# head(data)
# Custom the radarChart !
radarchart(data, axistype = 1,
#custom polygon
pcol = rgb(0.2, 0.5, 0.5, 0.9), pfcol = rgb(0.2, 0.5, 0.5, 0.5), plwd = 4,
#custom the grid
cglcol = 'grey', cglty = 1, axislabcol = 'grey', caxislabels = seq(0, 20, 5), cglwd = 0.8,
#custom labels
vlcex = 0.8
)
```
```{r, error = TRUE, results='asis'}
lib('radarchart')
labs <- c('Communicator', 'Data Wangler', 'Programmer', 'Technologist', 'Modeller', 'Visualizer')
scores <- list(
'Rich' = c(9, 7, 4, 5, 3, 7),
'Andy' = c(7, 6, 6, 2, 6, 9),
'Aimee' = c(6, 5, 8, 4, 7, 6))
chartJSRadar(scores = scores, labs = labs, maxScale = 10)
scores <- data.frame(
'Label' = c('Communicator', 'Data Wangler', 'Programmer', 'Technologist', 'Modeller', 'Visualizer'),
'Rich' = c(9, 7, 4, 5, 3, 7),
'Andy' = c(7, 6, 6, 2, 6, 9),
'Aimee' = c(6, 5, 8, 4, 7, 6))
chartJSRadar(scores, maxScale = 10, showToolTipLabel = TRUE)
chartJSRadar(skills, main = 'Data Science Radar')
chartJSRadarOutput('ID', width = '450', height = '300')
#runExampleApp('basic')
```
```{r, error = TRUE, results='asis'}
lib('fmsb', 'scales')
lib(c('ggradar', 'rescale', 'lattice', 'rgl', 'akima', 'metan'))
df_maxmin <- data.frame(
drat = c(1, 0),
wt = c(1, 0),
qsec = c(1, 0),
vs = c(1, 0),
am = c(1, 0))
#load data
mtcars_radar <- mtcars %>%
as_tibble(rownames = "group") %>%
mutate_at(vars(-group), rescale) %>%
tail(2) %>%
dplyr::select(1,6:10)
#check data type with std() function
str(mtcars_radar)
mtcars_radar <- mtcars_radar[,c('drat','wt','qsec','vs','am')]
mtcars_radar <- rbind(df_maxmin, mtcars_radar)
fmsb::radarchart(mtcars_radar)
```
```{r, error = TRUE, results='asis'}
#devtools::install_github('ricardo-bion/ggradar', dependencies = TRUE, force = T)
#devtools::install_github("poissonconsulting/rescale")
lib(c('ggradar', 'rescale', 'lattice', 'rgl', 'akima', 'metan'))
x=runif(1000)
y=runif(1000)
z=rnorm(1000)
s=interp(x,y,z,duplicate="strip")
surface3d(s$x,s$y,s$z,color="blue")
points3d(s)
x <- seq(-10, 10, length.out = 50)
y <- x
rotsinc <- function(x,y) {
sinc <- function(x) { y <- sin(x)/x ; y[is.na(y)] <- 1; y }
10 * sinc( sqrt(x^2+y^2) )
}
z <- outer(x, y, rotsinc)
persp(x, y, z)
surface3d(x, y, z)
# begin generating my 3D shape
b <- seq(from=0, to=20,by=0.5)
s <- seq(from=0, to=20,by=0.5)
payoff <- expand.grid(b=b,s=s)
payoff$payoff <- payoff$b - payoff$s
payoff$payoff[payoff$payoff < -1] <- -1
# end generating my 3D shape
wireframe(payoff ~ s * b, payoff, shade = TRUE, aspect = c(1, 1),
light.source = c(10,10,10), main = "Study 1",
scales = list(z.ticks=5,arrows=FALSE, col="black", font=10, tck=0.5),
screen = list(z = 40, x = -75, y = 0))
```
```{r, error=TRUE, results='asis'}
plot_rgl_model_a <- function(fdata, plot_contour = T, plot_points = T,
verbose = F, colour = "rainbow", smoother = F){
## takes a model in long form, in the format
## 1st column x
## 2nd is y,
## 3rd is z (height)
## and draws an rgl model
## includes a contour plot below and plots the points in blue
## if these are set to TRUE
# note that x has to be ascending, followed by y
if (verbose) print(head(fdata))
fdata <- fdata[order(fdata[, 1], fdata[, 2]), ]
if (verbose) print(head(fdata))
##
require(reshape2)
require(rgl)
orig_names <- colnames(fdata)
colnames(fdata) <- c("x", "y", "z")
fdata <- as.data.frame(fdata)
## work out the min and max of x,y,z
xlimits <- c(min(fdata$x, na.rm = T), max(fdata$x, na.rm = T))
ylimits <- c(min(fdata$y, na.rm = T), max(fdata$y, na.rm = T))
zlimits <- c(min(fdata$z, na.rm = T), max(fdata$z, na.rm = T))
l <- list (x = xlimits, y = ylimits, z = zlimits)
xyz <- do.call(expand.grid, l)
if (verbose) print(xyz)
x_boundaries <- xyz$x
if (verbose) print(class(xyz$x))
y_boundaries <- xyz$y
if (verbose) print(class(xyz$y))
z_boundaries <- xyz$z
if (verbose) print(class(xyz$z))
if (verbose) print(paste(x_boundaries, y_boundaries, z_boundaries, sep = ";"))
# now turn fdata into a wide format for use with the rgl.surface
fdata[, 2] <- as.character(fdata[, 2])
fdata[, 3] <- as.character(fdata[, 3])
#if (verbose) print(class(fdata[, 2]))
wide_form <- dcast(fdata, y ~ x, value_var = "z")
if (verbose) print(head(wide_form))
wide_form_values <- as.matrix(wide_form[, 2:ncol(wide_form)])
if (verbose) print(wide_form_values)
x_values <- as.numeric(colnames(wide_form[2:ncol(wide_form)]))
y_values <- as.numeric(wide_form[, 1])
if (verbose) print(x_values)
if (verbose) print(y_values)
wide_form_values <- wide_form_values[order(y_values), order(x_values)]
wide_form_values <- as.numeric(wide_form_values)
x_values <- x_values[order(x_values)]
y_values <- y_values[order(y_values)]
if (verbose) print(x_values)
if (verbose) print(y_values)
if (verbose) print(dim(wide_form_values))
if (verbose) print(length(x_values))
if (verbose) print(length(y_values))
zlim <- range(wide_form_values)
if (verbose) print(zlim)
zlen <- zlim[2] - zlim[1] + 1
if (verbose) print(zlen)
if (colour == "rainbow"){
colourut <- rainbow(zlen, alpha = 0)
if (verbose) print(colourut)
col <- colourut[ wide_form_values - zlim[1] + 1]
# if (verbose) print(col)
} else {
col <- "grey"
if (verbose) print(table(col2))
}
open3d()
plot3d(x_boundaries, y_boundaries, z_boundaries,
box = T, col = "black", xlab = orig_names[1],
ylab = orig_names[2], zlab = orig_names[3])
rgl.surface(z = x_values, ## these are all different because
x = y_values, ## of the confusing way that
y = wide_form_values, ## rgl.surface works! - y is the height!
coords = c(2,3,1),
color = col,
alpha = 1.0,
lit = F,
smooth = smoother)
if (plot_points){
# plot points in red just to be on the safe side!
points3d(fdata, col = "blue")
}
if (plot_contour){
# plot the plane underneath
flat_matrix <- wide_form_values
if (verbose) print(flat_matrix)
y_intercept <- (zlim[2] - zlim[1]) * (-2/3) # put the flat matrix 1/2 the distance below the lower height
flat_matrix[which(flat_matrix != y_intercept)] <- y_intercept
if (verbose) print(flat_matrix)
rgl.surface(z = x_values, ## these are all different because
x = y_values, ## of the confusing way that
y = flat_matrix, ## rgl.surface works! - y is the height!
coords = c(2,3,1),
color = col,
alpha = 1.0,
smooth = smoother)
}
}
add_rgl_model <- function(fdata){
## takes a model in long form, in the format