-
Notifications
You must be signed in to change notification settings - Fork 10
/
atom.xml
2738 lines (2350 loc) · 246 KB
/
atom.xml
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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[雁起平沙的网络日志]]></title>
<link href="http://yanping.me/cn/atom.xml" rel="self"/>
<link href="http://yanping.me/cn/"/>
<updated>2013-10-24T00:33:41+08:00</updated>
<id>http://yanping.me/cn/</id>
<author>
<name><![CDATA[ypchen]]></name>
<email><![CDATA[chen@yanping.me]]></email>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[关于Github Pages 视频教程]]></title>
<link href="http://yanping.me/cn/blog/2013/08/12/about-github-pages-step-by-step-video/"/>
<updated>2013-08-12T23:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/08/12/about-github-pages-step-by-step-video</id>
<content type="html"><![CDATA[<p>昨天我发布了《github pages视频教程(1)》,今晚就有童鞋留言反馈,提得很好,对我今后再录视频有很大的促进。同时,我也觉得有必要解释些几点,免得大家产生误解。</p>
<h3 id="section">一、我为什么要录这个视频</h3>
<p>没什么特别原因,就是有几位朋友用github做博客出了点问题,我就说,那我录个视频吧。然后一想,光是你们几个能看到视频还不行,估计还有很多朋友会遇到这些问题,那我就公开吧。</p>
<h3 id="github">二、什么是github?它能做什么?</h3>
<p>推荐大家阅读阳志平老师的<a href="www.yangzhiping.com/tech/github.html">如何高效利用GitHub</a></p>
<h3 id="github-1">三、为什么要用github做博客</h3>
<p>首先,准确地说,应该是用github托管博客。你注册github以后,它提供了这样一种机制,你可以在github上存放静态网站(纯html+css+js)的代码,然后,你可以通过访问一定的url地址来访问网站。而jekyll是一种基于ruby语言的轻量级静态网站生成引擎,请看我以前翻译的一篇<a href="http://yanping.me/cn/blog/2011/12/15/building-static-sites-with-jekyll/">介绍</a>。github的后台还提供jekyll的程序的服务,这样,你把未编译的jekyll博客代码push到github上,它会在后台帮你编译,你也可以本地编译之后再push。听不懂没关系,以后会讲的。</p>
<p>那为什么要用github呢?这纯粹是个人喜好问题,2011年底,我想开个博客,那时候统计之都的几位博主都是wordpress的博客,我也用了几天,然后谢益辉在邮件里提到用github能搭博客,我就研究了好几个星期,完全上瘾了。你可以看看益辉当时写的一篇<a href="http://yihui.name/cn/2011/10/back-into-the-dust/">博文</a>,阐述他为什么要换到jekyll。阳志平老师也有一篇<a href="http://www.yangzhiping.com/tech/wordpress-to-jekyll.html">告别wordpress,拥抱jekyll</a>,去网上搜一下,你会发现,叫这个名字的文章还真不少。</p>
<h3 id="github-pages">四、什么人适合用github pages</h3>
<p>我并没有向大家推销github和jekyll的意思,这套东西真的不适合所有人。如果你跟我一样是代码控、经常用github存放代码、觉得wordpress不灵活、想通过实践学习html/css/js,那么你可以试试用github托管博客。</p>
<p>两年以前,我跟大家一样,不会做网页,不懂html/css/js,之后偶尔学一点,在用中学,现在也能做出像点样子的网站了。</p>
<h3 id="jekyll">五、为什么用jekyll做的网站好看的不多?</h3>
<p>这是个天大的误解,网站好不好看,跟你用什么系统没关系,而是跟你的html/css/js有关,你可以把jekyll当作cms,网站样子好不好看,就要看你的设计了。很多用jekyll做博客的孩子都是程序猿,崇尚简洁,而且不会把大量时间花在设计上,也有网站设得很好的,比如 <a href="http://pizn.github.io">http://pizn.github.io</a> 。如果你能找到一个设计得很好的页面,完全可以用jekyll来做博客,当然,你也可以用wordpress做,跟系统没关系。</p>
<p>在第一期视频里,我举的那个例子用的是jekyll自带的最简单的模板,虽然很难看,但是它很简单,而且该有的都有了。在讲解的时候,我可以迅速定位到关键的代码,排除那些枝枝蔓蔓的影响。</p>
<h3 id="section-1">六、之后的视频教程会有什么?</h3>
<p>视频课程的第一次只是讲了基本概念,教你如何把别人的网站clone到自己的github里,还没有讲如何做一个属于自己的博客主题。这将是后面课程的重点。我先从修改别人的网站代码讲起吧。</p>
<h3 id="section-2">七、这个课不会教什么?</h3>
<p>我们这个课是关于github pages和jekyll的,不会教html/css/js,你需要自己去学,下面有些资源</p>
<ul>
<li><a href="http://www.w3school.com.cn/">W3schol</a></li>
<li><a href="http://zixue.it">自学it网</a></li>
<li><a href="http://wenku.baidu.com/course/list/5">百度文库课程</a></li>
</ul>
<p>当然,网上还有很多资源,不限于上面的,不过我觉得,更重要的是在实践中学习。</p>
<h3 id="section-3">八、不足之处</h3>
<p>第一次录视频,不太熟练,有点紧张,错了就要重来,可是,我发现越是紧张,就越会出错,那天从下午三点一直录到晚上八点,最终还是三段视频拼到一起的,重来一遍的代价太高了。我觉得应该分段录的,十几分钟一段。</p>
<p>另外,我的确应该重新注册个空白帐号的,我帐号里的东西太多,会分散大家注意力。下次我会用新帐号把这次视频的后半部分重讲一遍。</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Github Pages 视频教程(1)]]></title>
<link href="http://yanping.me/cn/blog/2013/08/11/github-pages-step-by-step-video/"/>
<updated>2013-08-11T10:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/08/11/github-pages-step-by-step-video</id>
<content type="html"><![CDATA[<p class="info">去年我写了一篇<a href="http://yanping.me/cn/blog/2012/03/18/github-pages-step-by-step/">《Github Pages极简教程》</a>,一年过去了,很多童鞋反映说在实际操作中遇到了这样那样的问题,而且github页面也改版了,jekyll也升级了,情况和当初有所不同。所以我就录了这个系列的视频,希望能对大家有所帮助。</p>
<div>
<embed src="http://static.youku.com/v/swf/qplayer.swf?winType=adshow&VideoIDS=XNTk0MjYxODQ0&isAutoPlay=false&isShowRelatedVideo=false" wmode="transparent" width="620" align="center" border="0" height="510" />
</div>
<div style="padding-top:20px;padding-bottom:20px;line-height:25px">
<strong><a href="http://yanping.me/cn/blog/2013/08/11/github-pages-step-by-step-video/">Github Pages 视频教程(1)</a></strong><br />
长度: 49 分 58 秒<br />
录制: 陈堰平<br />
<a href="http://v.youku.com/v_show/id_XNTk0MjYxODQ0.html" target="_blank">优酷播放</a> <br />
下载: <a href="http://pan.baidu.com/share/link?shareid=3678776452&uk=3288617424" target="_blank">高清视频文件</a>
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[【广告】上海北京两地的R语言培训]]></title>
<link href="http://yanping.me/cn/blog/2013/06/30/xccds-r-training/"/>
<updated>2013-06-30T19:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/06/30/xccds-r-training</id>
<content type="html"><![CDATA[<p>最近北京和上海有两个R语言培训。</p>
<p>我的朋友<a href="http://www.weibo.com/u/1400524015">肖凯老师</a>最近要在上海开R语言的培训班。他是资深R语言用户,“<a href="http://xccds.github.io">数据科学与R语言</a>”博客博主,第五届R语言大会演讲嘉宾,上市公司(万达信息股份有限公司)数据分析部数据分析师。R语言领域的实战专家。</p>
<p>想要了解详情的请看<a href="http://ww3.sinaimg.cn/large/644c05aejw1e6iz4iuympj20c822qk13.jpg">这里</a>。</p>
<p>另一个培训是SupStat推出的RHadoop的培训,想要玩大数据的童鞋可以了解一下,请看<a href="http://bbs.it-home.org/forum.php?mod=viewthread&tid=1876&page=1&extra=#pid5270">介绍</a>,SupStat的其他培训信息请看<a href="http://ypchen.inwake.com/files/upload/supstat-courses.pdf">这里</a>。</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[【译文】软件工程师如何修炼数据科学]]></title>
<link href="http://yanping.me/cn/blog/2013/05/25/software-engineers-guide-to-getting/"/>
<updated>2013-05-25T19:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/05/25/software-engineers-guide-to-getting</id>
<content type="html"><![CDATA[<p class="info">写这篇文章的是位软件工程师,本文是他的数据科学修炼历程,原文在<a href="http://www.rcasts.com/2012/12/software-engineers-guide-to-getting.html">这里</a></p>
<p>很多软件攻城狮朋友问我如何学习数据科学。其实已经有不少有名的数据科学家写过这方面的文章,比如<a href="http://www.dataspora.com/2009/05/sexy-data-geeks/" target="_blank">Dataspora</a>, <a href="http://gigaom.com/data/why-becoming-a-data-scientist-might-be-easier-than-you-think" target="_blank">Gigaom</a>, <a href="http://www.quora.com/Career-Advice/How-do-I-become-a-data-scientist" target="_blank">Quora</a>和<a href="http://www.hilarymason.com/blog/getting-started-with-data-science/" target="_blank">Hilary Mason</a>。 本文讲述的是我作为一名软件工程师学习统计和数据可视化的历程。</p>
<p>我是半路出家的,花了5年时间成为数据科学领域的<a href="http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition" target="_blank">熟练工(proficient)</a>,在我的学习过程中包括自学 (书籍, 博客, 简单实例)、工作中做项目、课堂培训(Stanford)、教学/演讲、会议(UseR, Strata)。 下面来讲讲到目前为止我做了哪些准备,其中哪些有用,哪些没用。</p>
<h2>1. 入门</h2>
<h3>a) 自学(2 - 4 个月)</h3>
<p><em>考察一下数据科学是否适合自己</em></p>
<p>入门很关键。两年前,我和几个同事组成了学习小组,一起学习<a href="http://stats202.com/" target="_blank">Stats 202</a>的课件。 这让我很兴趣,并且从那开始接触数据分析。 学习小组的5名成员中只有2名选择在这一领域研究的更深入(<a href="http://analytical-solution.com/2012/11/05/data-science-is-not-for-everyone/" target="_blank">数据科学并不适合所有人</a>)。<br /></p>
<ul>
<li><b>学习基础的统计学:</b><a href="http://stats202.com/" target="_blank">Stats 202</a>的课件非常适合入门</li>
<li><b>学习统计工具:</b> 作为一只菜鸟,我花了3个月的时间潜心学习。请看<a href="http://cran.r-project.org/" target="_blank">R</a> ,并获得了不少乐趣 <a href="http://www.rcasts.com/2011/03/why-learn-r.html" target="_blank">为什么学R</a>?</li>
<li><b>解决问题:</b>好奇心是数据科学的关键。如果你对国家经济、犯罪率统计以及体育比赛结果有疑问,那就找找数据自己解答你的疑问吧。</li>
<li><b>学习Unix工具:</b>我选择阅读 <a href="http://shop.oreilly.com/product/9780596802363.do" target="_blank">O'Reilly's Data Analysis with Open Source Tools (A hands-on guide for programmers and data scientists)</a></li>
<li><b>学习SQL和脚本语言:</b> 我会Java, Ruby和SQL。Python也在我的清单上。</li>
</ul>
<p>网上有很多学习资料</p>
<ul>
<li><a href="http://www.stanford.edu/class/stats202/" target="_blank">Stats 202</a></li>
<li><a href="http://work.caltech.edu/telecourse.html" target="_blank">Caltech Data Science course</a></li>
<li><a href="https://www.coursera.org/category/stats" target="_blank">Coursera</a>: <a href="https://www.coursera.org/course/datasci" target="_blank">Introduction to Data Science</a>, <a href="https://www.coursera.org/course/ml" target="_blank">Machine learning</a>, <a href="https://www.coursera.org/course/dataanalysis" target="_blank">Data Analysis</a>, <a href="https://www.coursera.org/course/compdata" target="_blank">Computing for Data Analysis</a></li>
<li><a href="http://datascienc.es/" target="_blank">University of California Berkeley - Introduction to Data Science</a></li>
<li><a href="http://open.journalismcourses.org/" target="_blank">Knight Center for Journalism's course on Introduction to Infographics and Data Visualization</a></li>
<li>Stats 101: <a href="http://www.udacity.com/overview/Course/st101/CourseRev/1" target="_blank">Udacity (Intro to Stats)</a>, <a href="https://www.khanacademy.org/math/probability/statistics" target="_blank">Khan academy</a>, <a href="http://oli.cmu.edu/courses/free-open/statistics-course-details/" target="_blank">Carnegie Mellon's stats course</a></li>
<li><a href="http://tryr.codeschool.com/" target="_blank">Learn R</a></li>
</ul>
<h3>b) 课堂培训 (9 - 12个月)</h3>
<p><em>如果你真的想学好,就参加一门正式的课程</em></p>
<p>如果你很认真地想学这门技术,那么最好参加课程学习。课程的艰难程度要保证我不会松懈。斯坦福提供了很棒的入门课程,比我参加的其他为期一周的培训课程要好很多。</p>
<ul>
<li><a href="http://www.stanford.edu/class/stats202/" target="_blank">Data Mining and Analysis STATS202</a></li>
<li><a href="http://www.stanford.edu/class/msande211/" target="_blank">Linear and Nonlinear Optimization MS&E211</a></li>
<li><a href="http://www.stanford.edu/class/cs246/" target="_blank">Mining Massive Data Sets CS246</a></li>
<li><a href="http://www-stat.stanford.edu/~tibs/stat315a/" target="_blank">Modern Applied Statistics: Learning STATS315A</a></li>
<li>Statistical Methods in Finance STATS240P</li>
<li><a href="http://www.stanford.edu/class/stats315b/" target="_blank">Modern Applied Statistics: Data Mining STATS315B</a></li>
</ul>
<!--more-->
<h2>2. 专注</h2>
<h3>a) 在数据科学方面花100%的时间</h3>
<ul>
<li>当我沉迷于数据科学时,我发现想用20%的时间来构建专业知识是很困难的。 必须花100%的时间在上面, 所以我寻找跟数据科学有关的问题 (大数据分析、医疗、市场营销以及零售分析、 最优化等问题)来解决</li>
</ul>
<h3>b) 研究有趣的问题</h3>
<ul>
<li>我的学习目标总是跟我感兴趣的事物联系起来。当我学习新的技术时,我发现用所学的知识解决有趣的问题是很另人兴趣和着迷的事。我对零售、医疗和体育 (<a href="http://www.rcasts.com/search/label/cricket" target="_blank">板球</a>)方面的数据分析很感兴趣</li>
</ul>
<h3>c) 加速学习</h3>
<ul>
<li><b>教学:</b>我给同事和朋友<a href="http://www.rcasts.com/2010/11/learning-r.html" target="_blank">培训R</a>和<a href="http://www.rcasts.com/2012/03/data-analysis-training.html" target="_blank">数据挖掘的入门课程</a>。这使我所学的知识得到巩固,而且让其他人对这一领域感兴趣。 这是我回馈开源社区的最好方式,写博客也是将我所学知识贡献出来的好办法。</li>
<li><b>关注数据科学领域的领导者:</b><a href="http://www.linkedin.com/in/dpatil" target="_blank">DJ Patil</a>,<a href="http://www.hilarymason.com/" target="_blank">Hillary Mason</a>,<a href="http://jeffhammerbacher.com/" target="_blank">Jeff Hammerbacher</a>,<a href="http://analytical-solution.com/" target="_blank">Carla Gentry</a>,<a href="http://blog.linkedin.com/author/mrogati/" target="_blank">Monica Rogati</a>,<a href="http://mathbabe.org/" target="_blank">Cathy O'Neil</a>。还有其他这方面的领导者。</li>
<li><b>关注有趣的博客:</b><a href="http://datascience101.wordpress.com/">http://datascience101.wordpress.com</a>,<a href="http://columbiadatascience.com/blog">http://columbiadatascience.com/blog</a>,<a href="http://www.r-bloggers.com/">http://www.r-bloggers.com</a>,<a href="http://www.datawrangling.com/">http://www.datawrangling.com</a>,<a href="http://flowingdata.com/">http://flowingdata.com</a>(<a href="http://www.quora.com/What-are-the-best-blogs-about-data-Why" target="_blank">Quora的最佳博客列表</a>)</li>
<li><b>定期参加会议和聚会:</b>本地的数据科学/R语言方面的聚会,<a href="http://strata.oreilly.com/" target="_blank">O'Reilly Strata</a>非常棒! 由于这个领域更新很快,所以我至少每隔一年去一次这个会议。<a href="http://www.r-project.org/conferences.html" target="_blank">UseR</a>会议 也很精彩,可以看看R语言世界发生了什么有趣的事。</li>
<li><b>学习大数据技术:</b>MapReduce/Hadoop,Cloud computing. 我避免选择商业软件 。现在看来,这是正确的决定。</li>
</ul>
<h3>d) 学习行业知识</h3>
<p>我很幸运,能够接触到数据科学内外的专家, 他们帮我理解他们处理数据科学问题的方法 (他们如何思考、 假设以及 test/access/reject解决方案)。我从他那里学到, “Hypothesis-driven data analysis”比”blind/brute-force data analysis”更加重要。这强调的重点是,对业务的理解要先于试图从数据中获取有意义的结论。 这引导我了解运筹、营销、零售、 旅行和物流(利润管理)以及医疗行业。 <a href="http://www.nytimes.com/2012/12/30/technology/big-data-is-great-but-dont-forget-intuition.html" target="_blank">纽约时报最近发表了一篇文章强调直觉的必要性</a>。</p>
<h2>
3. 数据科学方面有用的图书</h2>
<ul>
<li><a href="http://www.amazon.com/Introduction-Data-Mining-Pang-Ning-Tan/dp/0321321367" target="_blank">Introduction to Data Mining by Tan, Steinback and Kumar</a> 这本教材被很多入门级数据科学课程采用,比如Stanford的Stats 202</li>
<li><a href="http://www.amazon.com/Nutshell-Desktop-Quick-Reference-OReilly/dp/059680170X" target="_blank">R in a nutshell</a></li>
<li><a href="http://www.amazon.com/Data-Analysis-Open-Source-Tools/dp/0596802358" target="_blank">Data Analysis by using Open Source tools</a></li>
<li><a href="http://www.amazon.com/Beautiful-Visualization-Looking-through-Practice/dp/1449379869" target="_blank">Beautiful visualization</a></li>
<li>其他数据科学领域的图书:<a href="http://shop.oreilly.com/category/get/data-science-kit.do" target="_blank">O'Reilly</a>, <a href="http://myemail.constantcontact.com/Data-Science-books-at-Manning.html?soid=1101335703814&aid=F6MCzlEavBM" target="_blank">Manning</a></li>
</ul>
<h2>4. 对我没什么用的东西</h2>
<ul>
<li><b>学习多种统计工具:</b>一年以前,我接手的工作需要用到SAS编程,所以我想学SAS。我尝试了一个月,不过最终还是放弃了。主要原因是学习的惰性,以及我对另一种统计工具R的热爱。我实在不需要其他统计软件。我可以用R和其他我了解的软件<a href="http://cran.r-project.org/web/views/" target="_blank">解决数据科学里几乎所有的问题</a> 。所以我的建议是如果你已经对SAS,Stata,Matlab,SPSS,Statistica很熟悉,那就继续使用。如果你要学习新的统计工具,那就选R。 R 是开源软件,而其他软件是商业软件(昂贵且复杂)</li>
</ul>
<ul>
<li><b>在线公开课:</b>我曾经尝试在Coursera或其他 <a href="http://en.wikipedia.org/wiki/Massive_open_online_course" target="_blank">MOOC(在线公开课)</a>平台上自学,但是对于来说这样做效果并不理想。 我需要常规的、有压力的正式课程,经过艰苦的学习后能拿到学分</li>
</ul>
<ul>
<li><b>增加学术方面的工作量:</b>需要注意工作与生活的平衡。 今年早些时候,我尝试同时学习好几门很难的课程,后来很快意识到,我并不享受学习的过程。</li>
<li><b>只阅读课程教材:</b>很多课程的教材对我这样的软件工程师来说过于艰深了。所以我用其他资料来理解概念。比如,用<a href="http://www.stat.cmu.edu/~roeder/stat707/lectures.pdf" target="_blank">卡内基梅隆大学的笔记</a>学习回归</li>
</ul>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[《R语言编程艺术》即将上市]]></title>
<link href="http://yanping.me/cn/blog/2013/05/15/the-art-of-r-programming-published/"/>
<updated>2013-05-15T19:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/05/15/the-art-of-r-programming-published</id>
<content type="html"><![CDATA[<p style="height:0">
<a class="fancybox" style="text-decoration: none;" rel="gallery1" href="http://cos.name/wp-content/uploads/2013/05/art-of-r-big.jpg" title="The Art of R Programming">
<img src="http://cos.name/wp-content/uploads/2013/05/art-of-r-235x300.jpg" title="Hosted by imgur.com" style="float:right;margin:0 0 10px 20px" />
</a>
</p>
<p>经历千辛万苦之后,<em>The Art of R Programming</em>这本书终于被我们翻译成了《R语言编程艺术》。去年五月份机械工业出版社的<a href="http://weibo.com/maywuyi">吴怡</a>编辑与统计之都洽谈翻译本书,到现在已经整整一年了。这本书与其他R语言图书有很大的不同,它是由著名计算机科学家兼统计学家Norman Matloff撰写,从编程的角度来讲解R语言,并且深入浅出,非常适合入门,也可作为有R语言使用经验的人进阶。也正由于这本书的特别之处,使得翻译过程异常艰难,好在我们还有统计之都各位大佬的支持,很多把握不准的术语都是求助于他们,在此表示感谢。我在译者序中对本书做了详细介绍。</p>
<h2 id="section">译者序</h2>
<p>R是一种用于统计计算和统计作图的开源软件,同时也是种编程语言,它广泛应用于企业和学术界的数据分析领域,正在成为最通用语言之一。由于近几年数据挖掘、大数据等概念的走红,R也越来越多地被人关注。截止到本文完成之日,CRAN(<a href="http://cran.r-project.org/">http://cran.r-project.org/</a>)上共有4383个包,涉及统计、化学、经济、生物、医学、心理、社会学等各个学科。不同类型的公司,比如Google、辉瑞、默克、美国银行、洲际酒店集团和壳牌公司都在使用它,同时以S语言环境为基础的R语言由于其鲜明的特色,一出现就受到了统计专业人士的青睐,成为国外大学里相当标准的统计软件。</p>
<p>一直以来,国内外关于R语言的著作都是以统计学专业的视角来介绍R语言的,对R语言本身的特性讲解得并不详尽,而软件自带的官方文档又显得过于技术,不那么亲民。另一方面,很多接触R的朋友都来自非计算机专业,没有接受过编程训练,他们使用R的时候,写出来的代码通常只能算是一条条命令的集合,面对更复杂的问题,常常束手无策。记得在某届R语言大会上,有位SAS阵营的朋友说,他看到演讲者所展示的代码里只有函数调用,没有编程的东西,所以他觉得R不能算一种编程语言。其实,他错了,此时你手里这本《R语言编程艺术》,覆盖了其他大部分R语言图书没有涉及到的编程主题。这本书就如同R语言的九阳神功秘籍,当神功练成,任督二脉一旦打通,再学习针对某一领域应用的函数或包就如庖丁解牛一般。顺便提一下,据微博上的小道消息,前面提到的那位朋友最近也开始学R了。</p>
<p><strong>本书的特点表现在以下几个方面:</strong></p>
<ul>
<li>第一,对读者的统计学知识和编程水平要求并不高。与很多R语言书籍不同,这本书并不需要很深的统计学功底,它从纯语言的角度入手来讲解R。对于有一定编程经验却没什么统计学背景的人来说,读这本书会比较顺畅,读者就可以重点专注R语言的特性在数据分析方面的应用。在有的地方,作者也会提醒那些有其他语言编程经验的人应该注意R语言有什么不同之处。而对于没有编程经验又想使用R做数据分析的人来说,这本书也是学习编程的绝佳教材。</li>
<li>第二,专注于R语言编程。作者没有把这本书定位为菜谱式的手册,也不像有些R语言图书那样介绍完统计学某方面应用之后简单地把R语言代码摆出来。翻开这本书的目录,你几乎看不到统计学的术语。本书系统介绍了R语言的各种数据结构和编程结构、面向对象编程方法、socket网络编程、并行计算、代码调试、程序性能提升以及R语言与其他语言的接口等主题。书中也提到了不少编程的小技巧,这都是作者多年编程经验的总结。</li>
<li>第三,丰富的案例分析。作者Matloff教授是位计算机科学家,同时他也是位统计学家,有多年的教学经验,也做过统计学方法论的顾问。除了正文中的例子之外,本书还有44个扩展案例,很多案例源自作者亲身参与过的咨询项目。虽然本书没有讲解任何统计模型,但是扩展案例都是和数据分析相关的,比如鲍鱼数据的重编码(第二章)、寻找离群值(第三章)、文本词汇索引表(第四章)、汉语方言学习助手(第五章)等等。通过学习这些案例,读者不仅能学到R语言的每种概念如何运作,也会学到如何把这些概念组合到一起成为有用的程序。比如第十章介绍了socket网络编程之后,就用一个扩展案例讲解如何用socket实现并行计算,这为第十六章详细讲解并行计算做好了铺垫。在很多案例里,作者讨论了好几种设计方案,并比较了这几种方案的不同之处,以回答“为什么这样做?”,这对于缺少编程经验的人来说,是非常好的安排。</li>
</ul>
<!--more-->
<p>本书第一章简要介绍了R语言的几种数据结构和编程基础,其余章节可分为三大部分。</p>
<ul>
<li>第一部分 (第二至六章)详细介绍R的几种主要的数据结构:向量、矩阵、列表、数据框和因子。对很多人来说,R复杂多变的数据结构真的是一只拦路虎。而本书从最简单的向量开始,一步一步引导读者认识并掌握各种数据结构。</li>
<li>第二部分(第七至十三章)涉及编程方面: 编程结构和面向对象特性、输入/输出、 字符串处理以及绘图。值得一提的是第十三章,这章主要讲解的是R语言的调试。很多朋友在实际工作中有这样的经历,你可能用了一个小时就写好代码,却用了一天的时间来调试。可是到目前为止还没有在其他图书上看到与R语言调试相关的内容,甚至也很少见到关于其他编程语言调试的图书。本书刚好填补了这方面的空白。如果读者仔细读完第十三章,并实践其中的调试技巧,一定能事半功倍,也就能少熬点儿夜,有延长寿命的功效。本书的作者同时也著有《调式的艺术》(The Art of Debugging),相信他在R语言调试方面的功力也是相当深厚的。</li>
<li>第三部分介绍的是更高级的内容,比如执行速度和性能的提升(第十四章)、R语言与C/C++或python混合编程(第十五章)以及R语言并行计算(第十六章) ,虽然最后一部分属于编程的高级内容,但如果读者从前往后一直学下来,随着能力的提高,也是可以读懂的。</li>
</ul>
<p>本人从2007年开始接触R语言,那时候市面上几乎没有R语言方面的书籍。当时我关于R语言的所有信息几乎都是来自统计之都(<a href="http://cos.name">http://cos.name</a>)和谢益辉的博客(<a href="http://yihui.name">http://yihui.name</a>)。2008年冬天,统计之都成功举办了“第一届中国R语言会议”,来自各地的R语言用户们齐聚一堂,交流心得。从那以后,每年的R语言会议都会在北京和上海举办。这几年来统计之都的队伍也逐渐壮大,比如本书的其他三位主要译者:邱怡轩、潘岚锋和熊熹,当年他们参加R语言会议的时候还是人大统计学院大一大二的学生,后来也成为R语言社区的领军人物。去年我们接到本书的翻译任务时,他们三人分别收到了普度大学、爱荷华州立大学以及明尼苏达大学的录取通知,现在已经在美国留学深造。希望有越来越多的人加入统计之都的大家庭,和大家一起成长,为中国统计事业的发展尽自己的一份力。</p>
<p>在翻译过程中,几位译者力求忠实于原文,同时也兼顾中文表达的流畅,不过译文中仍可能有不当之处,欢迎读者予以指正。</p>
<p>除了本人以及前面提到的三位译者之外,统计之都的三位老朋友林宇、严紫丹和程豪也参与了本书部分章节的校审和初稿翻译,在此表示感谢。全书译文最后由本人统稿,如有错误之处,均由本人承担。</p>
<p>也感谢机械工业出版社的吴怡女士,她给予了我们细心帮助。</p>
<p>读者可以在统计之都的图书出版栏目(网址是<a href="http://cos.name/books/">http://cos.name/books/</a>)查看本书的页面,您可以在这里下载本书的数据和代码,也可以留言提问。</p>
<div style="width:300px;text-align:right;float:right">
陈堰平<br />
2013年3月于新华通讯社第三工作区
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[用js在jekyll博客中实现标签云和标签页]]></title>
<link href="http://yanping.me/cn/blog/2013/02/13/generate-tags-with-js-in-jekyll-blog/"/>
<updated>2013-02-13T15:30:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/02/13/generate-tags-with-js-in-jekyll-blog</id>
<content type="html"><![CDATA[<p class="info">本文主要讨论在jekyll博客中借助javascript和json,实现标签云和标签页。标签云可以用jquery.tagcloud.js插件实现,标签页则使用jQuery读取json数据文件,用地址传递参数给js函数,使用的是异步加载技术,请看<a href="http://art.yanping.me/tags/">演示页面</a>。</p>
<h2 id="section">标签云</h2>
<p>先做点准备工作,加载jquery。因为我的博客里还加载了其他的js库,在另外一个js库中也定义了$符号的话,那么我们在使用$符号时就发生了冲突。所以在加载jquery时还要解决$命名冲突。请看<a href="http://www.cnblogs.com/RascallySnake/archive/2010/05/07/1729417.html">这篇文章</a>,我用的办法是定义jQuery的别名:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><script </span><span class="na">src=</span><span class="s">"/js/jquery-1.7.1.min.js"</span> <span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">charset=</span><span class="s">"utf-8"</span><span class="nt">></script></span>
</span><span class="line"><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">jq</span> <span class="o">=</span> <span class="nx">jQuery</span><span class="p">.</span><span class="nx">noConflict</span><span class="p">();</span>
</span><span class="line"><span class="nt"></script></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>下面是标签云的代码:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><script </span><span class="na">src=</span><span class="s">"/js/jquery.tagcloud.js"</span> <span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">charset=</span><span class="s">"utf-8"</span><span class="nt">></script></span>
</span><span class="line"><span class="nt"><script </span><span class="na">language=</span><span class="s">"javascript"</span><span class="nt">></span>
</span><span class="line"> <span class="nx">jq</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">tagcloud</span><span class="p">.</span><span class="nx">defaults</span> <span class="o">=</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">start</span><span class="o">:</span> <span class="mi">12</span><span class="p">,</span>
</span><span class="line"> <span class="nx">end</span><span class="o">:</span> <span class="mi">22</span><span class="p">,</span>
</span><span class="line"> <span class="nx">unit</span><span class="o">:</span> <span class="s1">'px'</span>
</span><span class="line"> <span class="p">},</span>
</span><span class="line"> <span class="nx">color</span><span class="o">:</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">start</span><span class="o">:</span> <span class="s1">'#7CCD7C'</span><span class="p">,</span>
</span><span class="line"> <span class="nx">end</span><span class="o">:</span> <span class="s1">'#CD0000'</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> <span class="p">};</span>
</span><span class="line">
</span><span class="line"> <span class="nx">jq</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">(</span><span class="s1">'#tag_cloud a'</span><span class="p">).</span><span class="nx">tagcloud</span><span class="p">();</span>
</span><span class="line"> <span class="p">});</span>
</span><span class="line"><span class="nt"></script></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<h2 id="section-1">标签页</h2>
<p>最初,我是在谢益辉的博客里看到的<a href="http://yihui.name/cn/tags/">用js实现标签云</a>。可以看到,这个标签页上,在标签云之后跟着各个标签的文章列表,如果我只想看到某个标签的文章列表,要怎么做呢?</p>
<p>前面我写了篇文章<a href="http://yanping.me/cn/blog/2012/10/10/asynchronous-loading-post-list-with-jekyll-and-jQuery/">《用jekyll和jQuery实现异步加载文章列表》</a>,使用jQuery异步加载文章列表。同样的,我们也可以编写个函数加载某个标签的所有文章的列表。</p>
<!--more-->
<p>首先,生成文章列表数据的json模板是:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
</pre></td><td class="code"><pre><code class="html"><span class="line">---
</span><span class="line">layout: nil
</span><span class="line">---
</span><span class="line">
</span><span class="line">[
</span><span class="line">{% for post in site.posts %}
</span><span class="line"> {"title":"{{post.title}}",
</span><span class="line"> "url":"{{site.url}}{{post.url}}",
</span><span class="line"> "date":"{{ post.date | date:'%Y-%m-%d' }}",
</span><span class="line"> "tags":[{% for tag in post.tags %}"{{tag}}"{% if forloop.last == false %} ,{% endif %}{% endfor %}]}
</span><span class="line"> {% if forloop.last == false %},{% endif %}{% endfor %}
</span><span class="line">]
</span><span class="line">
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>用jekyll处理之后得到的json文件在<a href="http://art.yanping.me/post.json">这里</a>。</p>
<p>定义javascript函数showTag(),异步加载某一个标签的文章列表</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
<span class="line-number">24</span>
<span class="line-number">25</span>
<span class="line-number">26</span>
<span class="line-number">27</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></span>
</span><span class="line"> <span class="kd">function</span> <span class="nx">showTag</span><span class="p">(</span><span class="nx">tagStr</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">.</span><span class="nx">getJSON</span><span class="p">(</span><span class="s2">"../post.json"</span><span class="p">,</span>
</span><span class="line"> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">(</span><span class="s1">'#show-tag'</span><span class="p">).</span><span class="nx">empty</span><span class="p">(</span><span class="nx">content</span><span class="p">);</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">content</span> <span class="o">=</span> <span class="s2">"<h2>分类:"</span> <span class="o">+</span> <span class="nx">tagStr</span> <span class="o">+</span> <span class="s2">"</h2><ul class=\"posts\">"</span><span class="p">;</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span>
</span><span class="line"> <span class="kd">function</span><span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">item</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">item</span><span class="p">.</span><span class="nx">tags</span><span class="p">,</span>
</span><span class="line"> <span class="kd">function</span><span class="p">(</span><span class="nx">j</span><span class="p">,</span> <span class="nx">tag</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="k">if</span> <span class="p">(</span><span class="nx">tag</span> <span class="o">==</span> <span class="nx">tagStr</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">content</span> <span class="o">+=</span> <span class="s2">"<li class=\"listing-item\"><time datetime=\""</span> <span class="o">+</span> <span class="nx">item</span><span class="p">.</span><span class="nx">date</span> <span class="o">+</span> <span class="s2">"\">"</span> <span class="o">+</span> <span class="nx">item</span><span class="p">.</span><span class="nx">date</span> <span class="o">+</span> <span class="s2">"</time><a href=\""</span> <span class="o">+</span> <span class="nx">item</span><span class="p">.</span><span class="nx">url</span> <span class="o">+</span> <span class="s2">"\">"</span> <span class="o">+</span> <span class="nx">item</span><span class="p">.</span><span class="nx">title</span> <span class="o">+</span> <span class="s2">"</a></li>"</span><span class="p">;</span>
</span><span class="line"> <span class="nx">count</span><span class="o">++</span><span class="p">;</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="p">});</span>
</span><span class="line"> <span class="p">});</span>
</span><span class="line"> <span class="k">if</span> <span class="p">(</span><span class="nx">count</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">content</span> <span class="o">+=</span> <span class="s2">"</ul>"</span><span class="p">;</span>
</span><span class="line"> <span class="nx">postNumStr</span> <span class="o">=</span> <span class="s2">"<span>("</span> <span class="o">+</span> <span class="nx">count</span> <span class="o">+</span> <span class="s2">"篇文章)</span>"</span><span class="p">;</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">(</span><span class="s1">'#show-tag'</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="nx">content</span><span class="p">);</span>
</span><span class="line"> <span class="nx">jq</span><span class="p">(</span><span class="s1">'#show-tag>h2'</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="nx">postNumStr</span><span class="p">);</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> <span class="p">});</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"><span class="nt"></script></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>而标签页的核心代码为</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><div</span> <span class="na">id=</span><span class="s">"tag_cloud"</span><span class="nt">></span>
</span><span class="line"> {% for tag in site.tags %}
</span><span class="line"> <span class="nt"><a</span> <span class="na">href=</span><span class="s">"javascript:;"</span> <span class="na">onclick=</span><span class="s">"showTag('{{ tag[0] }}')"</span> <span class="na">title=</span><span class="s">"{{ tag[0] }}"</span> <span class="na">rel=</span><span class="s">"{{ tag[1].size }}"</span><span class="nt">></span>
</span><span class="line"> {{ tag[0] }}
</span><span class="line"> <span class="nt"></a></span>
</span><span class="line"> {% endfor %}
</span><span class="line"> <span class="nt"></div></span>
</span><span class="line">
</span><span class="line"><span class="nt"><div</span> <span class="na">id=</span><span class="s">"show-tag"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><div</span> <span class="na">style=</span><span class="s">"text-align:center"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><img</span> <span class="na">src=</span><span class="s">"/images/loading.gif"</span><span class="nt">/></span><span class="ni">&nbsp;&nbsp;</span>loading...
</span><span class="line"> <span class="nt"></div></span>
</span><span class="line"><span class="nt"></div></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>戳<a href="https://raw.github.com/yanping/art/gh-pages/tags/index.html">这里</a>查看完整代码。</p>
<p>下面这段代码用url地址来传递参数</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">href</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">;</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">pos</span> <span class="o">=</span> <span class="nx">href</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">'?tag='</span><span class="p">);</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">paraStr</span> <span class="o">=</span> <span class="nx">href</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="nx">pos</span> <span class="o">+</span> <span class="mi">5</span><span class="p">);</span>
</span><span class="line"> <span class="k">if</span> <span class="p">(</span><span class="nx">pos</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">showTag</span><span class="p">(</span><span class="nb">decodeURI</span><span class="p">(</span><span class="nx">paraStr</span><span class="p">));</span>
</span><span class="line"> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
</span><span class="line"> <span class="nx">showTag</span><span class="p">(</span><span class="s2">""</span><span class="p">);</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"><span class="nt"></script></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>post模板里的标签列表部分代码:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
</pre></td><td class="code"><pre><code class="html"><span class="line">{% if page.tags != empty %}
</span><span class="line"><span class="nt"><ul</span> <span class="na">class=</span><span class="s">"tags emphnext"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><li></span>标签:<span class="nt"></li></span>
</span><span class="line"> {% for tag in page.tags %}
</span><span class="line"> <span class="nt"><li></span>
</span><span class="line"> <span class="nt"><a</span> <span class="na">href=</span><span class="s">"{{ site.baseurl }}/tags/?tag={{tag | cgi}}"</span><span class="nt">></span>
</span><span class="line"> {{ tag }}
</span><span class="line"> <span class="nt"></a></span>
</span><span class="line"> {% if forloop.last == false %}, {%endif %}
</span><span class="line"> <span class="nt"></li></span>
</span><span class="line"> {% endfor %}
</span><span class="line"><span class="nt"></ul></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>侧面栏上标签列表的代码:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><div</span> <span class="na">id=</span><span class="s">"tag_sidebar"</span><span class="nt">></span>
</span><span class="line"> {% for tag in site.tags %}
</span><span class="line"> <span class="nt"><a</span> <span class="na">href=</span><span class="s">"{{site.baseurl}}/tags/?tag={{tag[0] | cgi}}"</span> <span class="na">title=</span><span class="s">"{{ tag[0] }}"</span><span class="nt">></span>
</span><span class="line"> {{ tag[0] }}<span class="nt"><sup></span>{{ tag[1].size }}<span class="nt"></sup></span><span class="ni">&nbsp;</span>
</span><span class="line"> <span class="nt"></a></span>
</span><span class="line"> {% endfor %}
</span><span class="line"><span class="nt"></div></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[用R获取flash中的数据]]></title>
<link href="http://yanping.me/cn/blog/2013/02/10/get-data-from-flash/"/>
<updated>2013-02-10T02:00:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/02/10/get-data-from-flash</id>
<content type="html"><![CDATA[<p class="info">本文主要讨论如何用R语言从flash中获取数据</p>
<p>某天我需要获取<a href="http://ifsfd.fudan.edu.cn/fdurmb/indexchart1.jsp">复旦人民币汇率指数</a>的数据。此前我们介绍过从网页抓取数据的两种方法</p>
<ol>
<li>用url给服务器提交参数获取数据文件,例如<a href="http://yanping.me/cn/blog/2012/12/09/get-dce-data/">用R获取大连商品交易所历史数据</a>这篇文章里提到的方法</li>
<li>解析html代码以获取数据,例如<a href="http://yanping.me/cn/blog/2013/02/09/get-zce-data/">用R获取郑州商品交易所历史数据</a>这篇文章里提到的方法</li>
</ol>
<p>而复旦的这个网页,不提供数据文件的下载,从html中也不能解析出数据。实际上,该网页中的flash向服务器发送请求,服务器返回数据给flash并显示出图形和表格。</p>
<p>用<a href="http://cos.name/cn/topic/107729">http://cos.name/cn/topic/107729</a>中<a href="http://www.road2stat.com/">Xiao Nan版主</a>介绍的办法,我用chrome看了下页面</p>
<p><img src="http://i.imgur.com/OqZSfRa.png" alt="network -> XHR" /></p>
<p>可以看到,上图中的表是从2012年12月12日到2013年2月10日的数据,对应的数据来自<a href="http://ifsfd.fudan.edu.cn/fdurmb/data?type=0%2C1%2C2&df=2012%2F12%2F12&dt=2013%2F02%2F10">http://ifsfd.fudan.edu.cn/fdurmb/data?type=0%2C1%2C2&df=2012%2F12%2F12&dt=2013%2F02%2F10</a>,打开这个链接,可以看出这是JSON格式,用R的rjson和RJSONIO包都可以解析JSON格式的数据。</p>
<p>我们来研究一下上面的这个链接,<code>df=2012%2F12%2F12&dt=2013%2F02%2F10</code>规定了从开始到结束的日期,如果开始日期是YYYY年MM月DD日,结束日期是yyyy年mm月dd日,那么对应的字符串是<code>df=YYYY%2FMM%2FDD&dt=yyyy%2Fmm%2Fdd</code></p>
<p>那么文本开头提出的问题,可用下面的代码解决</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span> (readFudan.r)</span> <a href="http://yanping.me/cn/downloads/code/readFudan.r">download</a></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
</pre></td><td class="code"><pre><code class="r"><span class="line"><span class="c1"># 从复旦人民币汇率指数网站读取数据 http://ifsfd.fudan.edu.cn/fdurmb/indexchart1.jsp</span>
</span><span class="line"><span class="c1"># 更多细节请看 http://cos.name/cn/topic/109132</span>
</span><span class="line">
</span><span class="line">require<span class="p">(</span>RCurl<span class="p">)</span>
</span><span class="line">require<span class="p">(</span>rjson<span class="p">)</span>
</span><span class="line">
</span><span class="line">fdjson <span class="o"><-</span> getURL<span class="p">(</span><span class="s">"http://ifsfd.fudan.edu.cn/fdurmb/data?type=0%2C1%2C2&df=2012%2F12%2F12&dt=2013%2F02%2F10"</span><span class="p">)</span>
</span><span class="line">fdlist <span class="o"><-</span> fromJSON<span class="p">(</span>fdjson<span class="p">)</span>
</span><span class="line">fdm <span class="o"><-</span> matrix<span class="p">(</span>unlist<span class="p">(</span>fdlist<span class="p">),</span>ncol<span class="o">=</span><span class="m">4</span><span class="p">,</span>byrow<span class="o">=</span><span class="k-Variable">T</span><span class="p">)</span>
</span><span class="line">fddf <span class="o"><-</span> data.frame<span class="p">(</span>fdm<span class="p">,</span> stringsAsFactors <span class="o">=</span> <span class="k-Variable">F</span><span class="p">)</span>
</span><span class="line">fddf<span class="p">[,</span><span class="m">2</span>:<span class="m">4</span><span class="p">]</span> <span class="o"><-</span> sapply<span class="p">(</span>fddf<span class="p">[,</span><span class="m">2</span>:<span class="m">4</span><span class="p">],</span>as.numeric<span class="p">)</span>
</span><span class="line">colnames<span class="p">(</span>fddf<span class="p">)</span> <span class="o"><-</span> c<span class="p">(</span><span class="s">"date"</span><span class="p">,</span><span class="s">"人民币名义有效汇率指数"</span><span class="p">,</span><span class="s">"人民币实际有效汇率指数"</span><span class="p">,</span><span class="s">"人民币盯住一篮子货币模拟汇率指数"</span><span class="p">)</span>
</span><span class="line">write.csv<span class="p">(</span>fddf<span class="p">,</span><span class="s">"fudan.csv"</span><span class="p">,</span>row.names <span class="o">=</span> <span class="k-Variable">F</span> <span class="p">)</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[R语言版的cntrade程序]]></title>
<link href="http://yanping.me/cn/blog/2013/02/10/cntrade-r-version/"/>
<updated>2013-02-10T02:00:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/02/10/cntrade-r-version</id>
<content type="html"><![CDATA[<p class="info">本文展示的是R语言版的cntrade程序</p>
<p>李春涛和张璇两位老师写了个<a href="http://ideas.repec.org/c/boc/bocode/s457580.html">名叫cntrade的stata程序</a>,用来从网易财经网获取沪深两市股票日度行情数据。</p>
<p>我用R重写了这个程序,请看:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span> (cntrade.r)</span> <a href="http://yanping.me/cn/downloads/code/cntrade.r">download</a></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
<span class="line-number">24</span>
<span class="line-number">25</span>
<span class="line-number">26</span>
<span class="line-number">27</span>
<span class="line-number">28</span>
<span class="line-number">29</span>
<span class="line-number">30</span>
<span class="line-number">31</span>
<span class="line-number">32</span>
<span class="line-number">33</span>
<span class="line-number">34</span>
<span class="line-number">35</span>
<span class="line-number">36</span>
<span class="line-number">37</span>
<span class="line-number">38</span>
<span class="line-number">39</span>
<span class="line-number">40</span>
<span class="line-number">41</span>
<span class="line-number">42</span>
<span class="line-number">43</span>
<span class="line-number">44</span>
<span class="line-number">45</span>
<span class="line-number">46</span>
<span class="line-number">47</span>
<span class="line-number">48</span>
<span class="line-number">49</span>
<span class="line-number">50</span>
<span class="line-number">51</span>
<span class="line-number">52</span>
<span class="line-number">53</span>
<span class="line-number">54</span>
<span class="line-number">55</span>
<span class="line-number">56</span>
<span class="line-number">57</span>
<span class="line-number">58</span>
<span class="line-number">59</span>
<span class="line-number">60</span>
<span class="line-number">61</span>
</pre></td><td class="code"><pre><code class="r"><span class="line"><span class="c1"># cntrade R语言版 </span>
</span><span class="line"><span class="c1"># 作者:陈堰平(统计之都,chen@yanping.me) </span>
</span><span class="line"><span class="c1"># 使用网易股票数据接口 原stata版的作者为:</span>
</span><span class="line"><span class="c1"># 李春涛(中南财经政法大学,chtl@znufe.edu.cn) </span>
</span><span class="line"><span class="c1"># 张璇(中南财经政法大学,zhangx@znufe.edu.cn) </span>
</span><span class="line"><span class="c1"># example: </span>
</span><span class="line"><span class="c1"># cntrade(c('600000', '000008'), path ='D:/stockprice', start = 20010104, end = 20120124)</span>
</span><span class="line">
</span><span class="line">cntrade <span class="o"><-</span> <span class="kr">function</span><span class="p">(</span>tickers<span class="p">,</span> path <span class="o">=</span> <span class="s">""</span><span class="p">,</span> start <span class="o">=</span> <span class="m">19910101</span><span class="p">,</span> end <span class="o">=</span> <span class="s">""</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line">
</span><span class="line"> address <span class="o"><-</span> <span class="s">"http://quotes.money.163.com/service/chddata.html"</span>
</span><span class="line"> field <span class="o"><-</span> <span class="s">"&fields=TCLOSE;HIGH;LOW;TOPEN;LCLOSE;CHG;PCHG;TURNOVER;VOTURNOVER;VATURNOVER;TCAP;MCAP"</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>path <span class="o">==</span> <span class="s">""</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> path <span class="o"><-</span> getwd<span class="p">()</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>!file.exists<span class="p">(</span>path<span class="p">))</span> <span class="p">{</span>
</span><span class="line"> dir.create<span class="p">(</span>path<span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>substr<span class="p">(</span>path<span class="p">,</span> nchar<span class="p">(</span>path<span class="p">),</span> nchar<span class="p">(</span>path<span class="p">))</span> <span class="o">!=</span> <span class="s">"/"</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> path <span class="o"><-</span> paste<span class="p">(</span>path<span class="p">,</span> <span class="s">"/"</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>end <span class="o">==</span> <span class="s">""</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> year <span class="o"><-</span> substr<span class="p">(</span>Sys.time<span class="p">(),</span> <span class="m">1</span><span class="p">,</span> <span class="m">4</span><span class="p">)</span>
</span><span class="line"> month <span class="o"><-</span> substr<span class="p">(</span>Sys.time<span class="p">(),</span> <span class="m">6</span><span class="p">,</span> <span class="m">7</span><span class="p">)</span>
</span><span class="line"> day <span class="o"><-</span> substr<span class="p">(</span>Sys.time<span class="p">(),</span> <span class="m">9</span><span class="p">,</span> <span class="m">10</span><span class="p">)</span>
</span><span class="line"> end <span class="o"><-</span> paste<span class="p">(</span>year<span class="p">,</span> month<span class="p">,</span> day<span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> count <span class="o"><-</span> <span class="m">0</span>
</span><span class="line"> tickers <span class="o"><-</span> as.character<span class="p">(</span>tickers<span class="p">)</span>
</span><span class="line"> <span class="kr">for</span> <span class="p">(</span>name in tickers<span class="p">)</span> <span class="p">{</span>
</span><span class="line"> <span class="kr">while</span> <span class="p">(</span>nchar<span class="p">(</span>name<span class="p">)</span> <span class="o"><</span> <span class="m">6</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> name <span class="o"><-</span> paste<span class="p">(</span><span class="s">"0"</span><span class="p">,</span> name<span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>nchar<span class="p">(</span>name<span class="p">)</span> <span class="o">></span> <span class="m">6</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> warning<span class="p">(</span>paste<span class="p">(</span><span class="s">"invalid stock code: "</span><span class="p">,</span> name<span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">))</span>
</span><span class="line"> next
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>as.numeric<span class="p">(</span>name<span class="p">)</span> <span class="o">></span> <span class="m">600000</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> url <span class="o"><-</span> paste<span class="p">(</span>address<span class="p">,</span> <span class="s">"?code=0"</span><span class="p">,</span> name<span class="p">,</span> <span class="s">"&start="</span><span class="p">,</span> start<span class="p">,</span> <span class="s">"&end="</span><span class="p">,</span> end<span class="p">,</span> field<span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span> <span class="kr">else</span> <span class="p">{</span>
</span><span class="line"> url <span class="o"><-</span> paste<span class="p">(</span>address<span class="p">,</span> <span class="s">"?code=1"</span><span class="p">,</span> name<span class="p">,</span> <span class="s">"&start="</span><span class="p">,</span> start<span class="p">,</span> <span class="s">"&end="</span><span class="p">,</span> end<span class="p">,</span> field<span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> destfile <span class="o"><-</span> paste<span class="p">(</span>path<span class="p">,</span> name<span class="p">,</span> <span class="s">".csv"</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> download.file<span class="p">(</span>url<span class="p">,</span> destfile<span class="p">,</span> quiet <span class="o">=</span> <span class="kc">TRUE</span><span class="p">)</span>
</span><span class="line"> count <span class="o"><-</span> count <span class="o">+</span> <span class="m">1</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>count <span class="o">==</span> <span class="m">0</span><span class="p">)</span> <span class="p">{</span>
</span><span class="line"> cat<span class="p">(</span><span class="s">"一个数据文件都没下载下来!\n"</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span> <span class="kr">else</span> <span class="p">{</span>
</span><span class="line"> cat<span class="p">(</span><span class="s">"数据下载完成!\n"</span><span class="p">)</span>
</span><span class="line"> cat<span class="p">(</span>paste<span class="p">(</span><span class="s">"共下载"</span><span class="p">,</span> count<span class="p">,</span> <span class="s">"个文件\n"</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">))</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>调用举例</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
</pre></td><td class="code"><pre><code class="r"><span class="line">cntrade<span class="p">(</span>c<span class="p">(</span><span class="s">'600000'</span><span class="p">,</span> <span class="s">'000001'</span><span class="p">,</span> <span class="s">'600810'</span><span class="p">),</span> path <span class="o">=</span> <span class="s">"d:\temp"</span><span class="p">,</span> start <span class="o">=</span> <span class="m">19990101</span><span class="p">,</span> end <span class="o">=</span> <span class="m">20121231</span><span class="p">)</span>
</span><span class="line">cntrade<span class="p">(</span>c<span class="p">(</span><span class="m">600000</span><span class="p">,</span> <span class="m">000001</span><span class="p">,</span> <span class="m">600810</span><span class="p">))</span>
</span><span class="line">cntrade<span class="p">(</span><span class="s">'000002'</span><span class="p">,</span> start <span class="o">=</span> <span class="m">19990101</span><span class="p">)</span>
</span><span class="line">cntrade<span class="p">(</span><span class="m">000002</span><span class="p">,</span> end <span class="o">=</span> <span class="m">19990101</span><span class="p">)</span>
</span><span class="line">cntrade<span class="p">(</span>c<span class="p">(</span><span class="m">2</span><span class="p">,</span> <span class="m">16</span><span class="p">))</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>stata版的介绍请看<a href="http://blog.sina.com.cn/s/blog_6af14ae20101ggnz.html">http://blog.sina.com.cn/s/blog_6af14ae20101ggnz.html</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[用R获取郑州商品交易所历史数据]]></title>
<link href="http://yanping.me/cn/blog/2013/02/09/get-zce-data/"/>
<updated>2013-02-09T20:00:00+08:00</updated>
<id>http://yanping.me/cn/blog/2013/02/09/get-zce-data</id>
<content type="html"><![CDATA[<p class="info">本文主要讨论如何用R语言从郑州商品交易所网站上获取期货合约交易数据</p>
<p>郑商所网站提供了查询每日行情的<a href="http://www.czce.com.cn/portal/jysj/mrhq/A091101index_1.htm">页面</a>,它提供的数据比大商所的要复杂一些,2010年至2013年的网页格式一样,地址也是同样的形式,请看</p>
<ul>
<li><a href="http://www.czce.com.cn/portal/exchange/2010/datadaily/20100105.htm">http://www.czce.com.cn/portal/exchange/2010/datadaily/20100105.htm</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/2011/datadaily/20110105.htm">http://www.czce.com.cn/portal/exchange/2011/datadaily/20110105.htm</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/2012/datadaily/20120104.htm">http://www.czce.com.cn/portal/exchange/2012/datadaily/20120104.htm</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/2013/datadaily/20130104.htm">http://www.czce.com.cn/portal/exchange/2013/datadaily/20130104.htm</a></li>
</ul>
<p>打开网页可以看到,网页提供了“打印”,“Excel”和“txt”三个选项,只要把地址后面的<code>.html</code>改为<code>.txt</code>就可以得到文本格式的数据,那么就可以逐一下载数据文件,读入数据。</p>
<p>这四年的数据可以这样获取:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
<span class="line-number">24</span>
<span class="line-number">25</span>
<span class="line-number">26</span>
<span class="line-number">27</span>
<span class="line-number">28</span>
</pre></td><td class="code"><pre><code class="r"><span class="line">getZceData <span class="o"><-</span> <span class="kr">function</span><span class="p">(</span>dates<span class="p">){</span>
</span><span class="line"> require<span class="p">(</span>RCurl<span class="p">)</span>
</span><span class="line"> zceDatabase <span class="o"><-</span> data.frame<span class="p">()</span>
</span><span class="line"> <span class="kr">for</span> <span class="p">(</span>date in dates<span class="p">)</span> <span class="p">{</span>
</span><span class="line"> str1 <span class="o"><-</span> <span class="s">"http://www.czce.com.cn/portal/exchange/"</span>
</span><span class="line"> str2 <span class="o"><-</span> <span class="s">"/datadaily/"</span>
</span><span class="line"> date <span class="o"><-</span> as.character<span class="p">(</span>date<span class="p">)</span>
</span><span class="line"> year <span class="o"><-</span> substr<span class="p">(</span>date<span class="p">,</span> <span class="m">1</span><span class="p">,</span> <span class="m">4</span><span class="p">)</span>
</span><span class="line"> url <span class="o"><-</span> paste<span class="p">(</span>str1<span class="p">,</span> year<span class="p">,</span> str2<span class="p">,</span> date<span class="p">,</span> <span class="s">".txt"</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>!url.exists<span class="p">(</span>url<span class="p">))</span> <span class="p">{</span>
</span><span class="line"> next
</span><span class="line"> <span class="p">}</span> <span class="kr">else</span> <span class="p">{</span>
</span><span class="line"> colnames <span class="o"><-</span> c<span class="p">(</span><span class="s">"品种月份"</span><span class="p">,</span> <span class="s">"昨结箿"</span><span class="p">,</span> <span class="s">"今开盘"</span><span class="p">,</span> <span class="s">"最高价"</span><span class="p">,</span> <span class="s">"最低价"</span><span class="p">,</span>
</span><span class="line"> <span class="s">"今收盘"</span><span class="p">,</span> <span class="s">"今结算"</span><span class="p">,</span> <span class="s">"涨跌1"</span><span class="p">,</span> <span class="s">"涨跌2"</span><span class="p">,</span> <span class="s">"成交量"</span><span class="p">,</span> <span class="s">"空盘量"</span><span class="p">,</span>
</span><span class="line"> <span class="s">"增减量"</span><span class="p">,</span> <span class="s">"成交额"</span><span class="p">,</span> <span class="s">"交割结算价"</span><span class="p">)</span>
</span><span class="line"> fileName <span class="o"><-</span> paste<span class="p">(</span><span class="s">"zce"</span><span class="p">,</span> date<span class="p">,</span> <span class="s">".txt"</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">""</span><span class="p">)</span>
</span><span class="line">
</span><span class="line"> <span class="kr">if</span> <span class="p">(</span>!file.exists<span class="p">(</span>fileName<span class="p">))</span> <span class="p">{</span>
</span><span class="line"> download.file<span class="p">(</span>url<span class="p">,</span> fileName<span class="p">,</span> quiet <span class="o">=</span> <span class="k-Variable">T</span><span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> zceData <span class="o"><-</span> read.table<span class="p">(</span>fileName<span class="p">,</span> header <span class="o">=</span> <span class="k-Variable">F</span><span class="p">,</span> skip <span class="o">=</span> <span class="m">1</span><span class="p">,</span> sep <span class="o">=</span> <span class="s">","</span><span class="p">,</span> col.names <span class="o">=</span> colnames<span class="p">)</span>
</span><span class="line"> zceData <span class="o"><-</span> zceData<span class="p">[(</span>zceData<span class="p">[,</span> <span class="m">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">"小计"</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span>zceData<span class="p">[,</span> <span class="m">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">"总计"</span><span class="p">),</span> <span class="p">]</span>
</span><span class="line"> zceData<span class="p">$</span>date <span class="o"><-</span> date
</span><span class="line"> zceDatabase <span class="o"><-</span> rbind<span class="p">(</span>zceDatabase<span class="p">,</span> zceData<span class="p">)</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> <span class="p">}</span>
</span><span class="line"> <span class="kr">return</span><span class="p">(</span>zceDatabase<span class="p">)</span>
</span><span class="line"><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>但是查询2009年及之前的数据返回的是网页形式,那就需要从网页上读取。</p>
<p>看下面几个链接</p>
<ul>
<li><a href="http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20060106.html">http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20060106.html</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20070104.html">http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20070104.html</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20080104.html">http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20080104.html</a></li>
<li><a href="http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20090105.html">http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20090105.html</a></li>
</ul>
<p>网页格式很统一,数据在被table标签包裹,并且是在第二个table标签中,XML包的<code>readHTMLTable</code>函数可以读取table标签中的内容,但是当网页中有汉字的时候,汉字会变成乱码,慎用!</p>
<p>不过,本文的情况有点特殊,汉字只出现在table的第一行表头,以及“小计”、“总计”的行,这些行本来就是要去掉的,所以对我们没影响。</p>
<p>下面只给出关键代码:</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
</pre></td><td class="code"><pre><code class="r"><span class="line">require<span class="p">(</span>XML<span class="p">)</span>
</span><span class="line">require<span class="p">(</span>stringr<span class="p">)</span>
</span><span class="line">url <span class="o"><-</span> <span class="s">"http://www.czce.com.cn/portal/exchange/jyxx/hq/hq20060106.html"</span>
</span><span class="line">tb <span class="o"><-</span>readHTMLTable<span class="p">(</span>url<span class="p">)[[</span><span class="m">2</span><span class="p">]]</span>
</span><span class="line">tb <span class="o"><-</span> sapply<span class="p">(</span>tb<span class="p">,</span>str_trim<span class="p">)</span>
</span><span class="line">df <span class="o"><-</span>as.data.frame<span class="p">(</span>apply<span class="p">(</span>tb<span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="kr">function</span><span class="p">(</span>x<span class="p">)</span> iconv<span class="p">(</span>x<span class="p">,</span> from <span class="o">=</span> <span class="s">"gb2312"</span><span class="p">,</span> to <span class="o">=</span> <span class="s">"UTF-8"</span><span class="p">)))</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>再把第一列为NA的行去除就行了。</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[用R获取大连商品交易所历史数据]]></title>
<link href="http://yanping.me/cn/blog/2012/12/09/get-dce-data/"/>
<updated>2012-12-09T20:00:00+08:00</updated>
<id>http://yanping.me/cn/blog/2012/12/09/get-dce-data</id>
<content type="html"><![CDATA[<p class="info">本文主要讨论如何用R语言从大连商品交易所网站上获取期货合约交易数据</p>
<p>大商所的网站上有提供查询历史的<a href="http://www.dce.com.cn/portal/cate?cid=1261730308135">页面</a>。但是它只能对某一个品种查询某一天的报价,或者某一天所有品种的报价,如果我想批量获取交易数据,应该怎么做呢?</p>
<p>首先剖析一下这个页面,用firefox的firebug查看日行情表的代码</p>
<p><img src="http://i.imgur.com/PFZ4f1k.png" alt="日行情表" /></p>
<p>可以看到,这个表实际上是用iframe实现的,查看页面的源文件可以查出这个iframe引用页面地址为<a href="http://www.dce.com.cn/PublicWeb/MainServlet?action=Data_service">http://www.dce.com.cn/PublicWeb/MainServlet?action=Data_service</a>。用上面的方法继续剖析这个页面,发现它引用了<a href="http://www.dce.com.cn/PublicWeb/MainServlet?action=Pu00011_search">http://www.dce.com.cn/PublicWeb/MainServlet?action=Pu00011_search</a>。</p>
<!--more-->
<p>先忽略无关的代码,只关注下面这部分</p>
<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span /></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
<span class="line-number">24</span>
<span class="line-number">25</span>
<span class="line-number">26</span>
<span class="line-number">27</span>
<span class="line-number">28</span>
<span class="line-number">29</span>
<span class="line-number">30</span>
<span class="line-number">31</span>
<span class="line-number">32</span>
<span class="line-number">33</span>
<span class="line-number">34</span>
<span class="line-number">35</span>
<span class="line-number">36</span>
<span class="line-number">37</span>
<span class="line-number">38</span>
<span class="line-number">39</span>
<span class="line-number">40</span>
<span class="line-number">41</span>
<span class="line-number">42</span>
<span class="line-number">43</span>
<span class="line-number">44</span>
<span class="line-number">45</span>
<span class="line-number">46</span>
<span class="line-number">47</span>
<span class="line-number">48</span>
<span class="line-number">49</span>
<span class="line-number">50</span>
<span class="line-number">51</span>
<span class="line-number">52</span>
<span class="line-number">53</span>
<span class="line-number">54</span>
<span class="line-number">55</span>
<span class="line-number">56</span>
<span class="line-number">57</span>
</pre></td><td class="code"><pre><code class="html"><span class="line"><span class="nt"><form</span> <span class="na">target=</span><span class="s">"_blank"</span> <span class="na">name=</span><span class="s">"form1"</span> <span class="na">action=</span><span class="s">"/PublicWeb/MainServlet"</span> <span class="na">method=</span><span class="s">"post"</span> <span class="na">onSubmit=</span><span class="s">"return formcheck(this);"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><input</span> <span class="na">type=</span><span class="s">"hidden"</span> <span class="na">name=</span><span class="s">"action"</span> <span class="na">value=</span><span class="s">"Pu00011_result"</span><span class="nt">></span>
</span><span class="line"><span class="nt"><tr</span> <span class="na">valign=</span><span class="s">"top"</span><span class="nt">></span>
</span><span class="line"><span class="nt"><td</span> <span class="na">height=</span><span class="s">"10"</span><span class="nt">></td></span>
</span><span class="line"><span class="nt"></tr></span>
</span><span class="line"> <span class="nt"><tr</span> <span class="na">valign=</span><span class="s">"top"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">height=</span><span class="s">"133"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"title"</span><span class="nt">></span>日 行 情 表<span class="nt"></div></span>
</span><span class="line"><span class="nt"><table</span> <span class="na">border=</span><span class="s">"0"</span> <span class="na">align=</span><span class="s">"center"</span> <span class="na">cellpadding=</span><span class="s">"3"</span> <span class="na">cellspacing=</span><span class="s">"1"</span> <span class="na">width=</span><span class="s">"97%"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><tr></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"nametd"</span><span class="nt">></span> 查询日期:<span class="nt"></td></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"tdjian"</span> <span class="nt">><input</span> <span class="na">name=</span><span class="s">"Pu00011_Input.trade_date"</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">size=</span><span class="s">"8"</span> <span class="na">maxlength=</span><span class="s">"8"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><img</span> <span class="na">align=</span><span class="s">"absmiddle"</span> <span class="na">src=</span><span class="s">"/PublicWeb/include/images/calendar/show.gif"</span> <span class="na">id=</span><span class="s">"Pu00011_Input.trade_date.img"</span> <span class="na">onClick=</span><span class="s">'swapCalendar(document.all("Pu00011_Input.trade_date"))'</span> <span class="na">valign=</span><span class="s">"bottom"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"></td></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"nametd"</span><span class="nt">></span> 品 种:<span class="nt"></td></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"tdjian"</span><span class="nt">><select</span> <span class="na">name=</span><span class="s">"Pu00011_Input.variety"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">selected</span> <span class="na">value=</span><span class="s">"all"</span><span class="nt">></span>全部<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"a"</span><span class="nt">></span>豆一<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"b"</span><span class="nt">></span>豆二<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"c"</span><span class="nt">></span>玉米<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"j"</span><span class="nt">></span>焦炭<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"l"</span><span class="nt">></span>聚乙烯<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"m"</span><span class="nt">></span>豆粕<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"p"</span><span class="nt">></span>棕榈油<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"v"</span><span class="nt">></span>聚氯乙烯<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"y"</span><span class="nt">></span>豆油<span class="nt"></option></span>
</span><span class="line"> <span class="nt"><option</span> <span class="na">value=</span><span class="s">"s"</span><span class="nt">></span>大豆<span class="nt"></option></span>
</span><span class="line"> <span class="nt"></select></td></span>
</span><span class="line"> <span class="nt"></tr></span>
</span><span class="line"> <span class="nt"><tr></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"nametd"</span><span class="nt">></span> <span class="nt"><p></span> 行情类型:<span class="nt"></p></span> <span class="nt"></td></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"tdjian"</span> <span class="na">colspan=</span><span class="s">"3"</span><span class="nt">></span> <span class="nt"><input</span> <span class="na">name=</span><span class="s">"Pu00011_Input.trade_type"</span> <span class="na">type=</span><span class="s">"radio"</span> <span class="na">value=</span><span class="s">"0"</span> <span class="na">checked</span><span class="nt">></span>期货行情
</span><span class="line"> <span class="c"><!--hide option</span>
</span><span class="line"><span class="c"> <input name="Pu00011_Input.trade_type" type="radio" value="1">期权行情</span>
</span><span class="line"><span class="c"> --></span>
</span><span class="line"> <span class="nt"></td></span>
</span><span class="line"> <span class="nt"></tr></span>
</span><span class="line"><span class="nt"></table></span>
</span><span class="line"><span class="nt"><script </span><span class="na">language=</span><span class="s">"javascript"</span><span class="nt">></span>
</span><span class="line"> <span class="nx">calendarImages</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"/PublicWeb/include/images/calendar/prev_year.gif"</span><span class="p">,</span> <span class="s2">"/PublicWeb/include/images/calendar/prev_month.gif"</span><span class="p">,</span> <span class="s2">"/PublicWeb/include/images/calendar/next_month.gif"</span><span class="p">,</span> <span class="s2">"/PublicWeb/include/images/calendar/next_year.gif"</span><span class="p">,</span> <span class="s2">"/PublicWeb/include/images/calendar/show.gif"</span><span class="p">,</span> <span class="s2">"/PublicWeb/include/images/calendar/hide.gif"</span><span class="p">]</span>
</span><span class="line"> <span class="nx">getCalendar</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="s2">"Pu00011_Input.trade_date"</span><span class="p">),</span> <span class="s1">'20130208'</span><span class="p">);</span>
</span><span class="line"><span class="nt"></script></span>
</span><span class="line"><span class="nt"><table</span> <span class="na">border=</span><span class="s">"0"</span> <span class="na">align=</span><span class="s">"center"</span> <span class="na">cellpadding=</span><span class="s">"5"</span> <span class="na">cellspacing=</span><span class="s">"0"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><tr></span>
</span><span class="line"> <span class="nt"><td><input</span> <span class="na">name=</span><span class="s">"Submit"</span> <span class="na">type=</span><span class="s">"submit"</span> <span class="na">class=</span><span class="s">"button"</span> <span class="na">value=</span><span class="s">"查 询"</span> <span class="na">onClick=</span><span class="s">"document.form1.action.value='Pu00011_result';document.form1.target='_blank';"</span><span class="nt">></span><span class="ni">&nbsp;&nbsp;</span><span class="nt"><input</span> <span class="na">name=</span><span class="s">"Submit2"</span> <span class="na">type=</span><span class="s">"submit"</span> <span class="na">class=</span><span class="s">"downbutton"</span> <span class="na">value=</span><span class="s">"下载文本格式"</span> <span class="na">onClick=</span><span class="s">"document.form1.action.value='Pu00012_download';document.form1.target='_self';"</span><span class="nt">></span><span class="ni">&nbsp;&nbsp;</span><span class="nt"><input</span> <span class="na">name=</span><span class="s">"Submit2"</span> <span class="na">type=</span><span class="s">"submit"</span> <span class="na">class=</span><span class="s">"button"</span> <span class="na">value=</span><span class="s">"打 印"</span> <span class="na">onClick=</span><span class="s">"document.form1.action.value='Pu00011_result';document.form1.target='_blank';"</span><span class="nt">></td></span>
</span><span class="line"> <span class="nt"></tr></span>
</span><span class="line"><span class="nt"></table></span>
</span><span class="line"><span class="nt"><table</span> <span class="na">border=</span><span class="s">"0"</span> <span class="na">align=</span><span class="s">"center"</span> <span class="na">cellpadding=</span><span class="s">"1"</span> <span class="na">cellspacing=</span><span class="s">"0"</span> <span class="na">width=</span><span class="s">"97%"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><tr</span> <span class="na">align=</span><span class="s">"left"</span><span class="nt">></span>
</span><span class="line"> <span class="nt"><td</span> <span class="na">width=</span><span class="s">20</span> <span class="na">valign=</span><span class="s">top</span><span class="nt">></span>注:<span class="nt"></td></span>
</span><span class="line"> <span class="nt"><td></span>
</span><span class="line"> 日行情信息 在每日“结算后”发布。历史数据始自2000-05-08。
</span><span class="line"> <span class="nt"></td></span>
</span><span class="line"> <span class="nt"></tr></span>
</span><span class="line"><span class="nt"></table></span>
</span><span class="line">
</span><span class="line"> <span class="nt"></form></span>
</span></code></pre></td></tr></table></div></figure></notextile></div>