<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生信菜鸟团 &#187; Rstudio</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/rstudio/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bio-info-trainee.com</link>
	<description>欢迎去论坛biotrainee.com留言参与讨论，或者关注同名微信公众号biotrainee</description>
	<lastBuildDate>Sat, 28 Jun 2025 14:30:13 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.33</generator>
	<item>
		<title>用php脚本把Rstudio公司的所有cheatsheet合并</title>
		<link>http://www.bio-info-trainee.com/1673.html</link>
		<comments>http://www.bio-info-trainee.com/1673.html#comments</comments>
		<pubDate>Thu, 02 Jun 2016 23:51:19 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[计算机基础]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rstudio]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=1673</guid>
		<description><![CDATA[R studio公司毕竟是商业化公司，在R语言推广方面做得很棒。网站什么总共有9 &#8230; <a href="http://www.bio-info-trainee.com/1673.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>R studio公司毕竟是商业化公司，在R语言推广方面做得很棒。网站什么总共有9个cheatsheet，R语言入门完全可以把这个当做笔记，写代码随时查用！</p>
<p>我批量下载了所有，但是想打印的时候，发现挺麻烦的，因为我不知道批量打印的方法，索性我还是半个程序猿，所以搜索了一下批量合并pdf的方法，这样就可以批量打印了，也方便传输这个文件。</p>
<p>其实如果在linux系统里面，一般都会自带pdf toolkit工具，里面有命令可以合并PDF文档。<span id="more-1673"></span></p>
<p>正好我搜索到了一个比较好玩的实现方法，就是PHP脚本，我还是第一次听说PHP也可以来当做脚本运行，简单浏览了一下，发现跟perl其实差不多，它需要require一些其它public的php脚本，perl就是需要载入一些模块。</p>
<p>首先列出所有下载地址，用wget批量来下载：</p>
<blockquote><p><a href="http://www.rstudio.com/wp-content/uploads/2016/05/base-r.pdf">http://www.rstudio.com/wp-content/uploads/2016/05/base-r.pdf</a></p>
<p><a href="http://www.rstudio.com/wp-content/uploads/2016/02/advancedR.pdf">http://www.rstudio.com/wp-content/uploads/2016/02/advancedR.pdf</a></p>
<p><a href="http://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf">http://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2015/06/devtools-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2015/06/devtools-cheatsheet.pdf</a></p>
<p><a href="https://www.rstudio.com/wp-content/uploads/2015/02/shiny-cheatsheet.pdf">https://www.rstudio.com/wp-content/uploads/2015/02/shiny-cheatsheet.pdf</a></p></blockquote>
<p>然后写一个PHP函数，get到待合并目录下面的所有pdf文件：</p>
<blockquote><p>&lt;?php</p>
<p>$dir="./Rstudio_cheatsheets/";</p>
<p><strong>$file=array_diff(scandir($dir),array('..','.'));</strong></p>
<p>print_r($file);</p>
<p>?&gt;</p></blockquote>
<p>上面的代码相当于简单的PHP语法入门，其实这个语言感觉跟perl挺像的，就是列出文件夹里面的文件。</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/06/1.png"><img class="alignnone size-full wp-image-1674" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/06/1.png" alt="1" width="603" height="264" /></a></p>
<p>然后需要下载两个PHP压缩包，解压到当前文件夹</p>
<p>FPDF: <a href="http://www.fpdf.org/en/download.php">http://www.fpdf.org/en/download.php</a></p>
<p>FPDI: <a href="https://www.setasign.com/products/fpdi/downloads">https://www.setasign.com/products/fpdi/downloads</a></p>
<p>然后写一个脚本来实现合并的功能。</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2016/06/2.png"><img class="alignnone size-full wp-image-1675" src="http://www.bio-info-trainee.com/wp-content/uploads/2016/06/2.png" alt="2" width="462" height="324" /></a></p>
<p>这个语法对我来说很诡异，最后居然还报错！！！</p>
<blockquote><p>PHP Fatal error:  Uncaught exception 'Exception' with message 'This document (/home/jmzeng/tmp/test_php/Rstudio_cheatsheets/advancedR.pdf) <strong>probably uses a compression technique which is not supported by the free parser shipped with FPDI. </strong>(See <a href="https://www.setasign.com/fpdi-pdf-parser">https://www.setasign.com/fpdi-pdf-parser</a> for more details)' in /home/jmzeng/tmp/test_php/pdf_parser.php:322</p>
<p>Stack trace:</p>
<p>#0 /home/jmzeng/tmp/test_php/pdf_parser.php(195): pdf_parser-&gt;_readXref(Array, 116)</p>
<p>#1 /home/jmzeng/tmp/test_php/fpdi_pdf_parser.php(64): pdf_parser-&gt;__construct('/home/jmzeng/tm...')</p>
<p>#2 /home/jmzeng/tmp/test_php/fpdi.php(123): fpdi_pdf_parser-&gt;__construct('/home/jmzeng/tm...')</p>
<p>#3 /home/jmzeng/tmp/test_php/fpdi.php(101): FPDI-&gt;_getPdfParser('/home/jmzeng/tm...')</p>
<p>#4 /home/jmzeng/tmp/test_php/merge_pdf.php(11): FPDI-&gt;setSourceFile('advancedR.pdf')</p>
<p>#5 {main}</p>
<p>thrown in /home/jmzeng/tmp/test_php/pdf_parser.php on line 322</p></blockquote>
<p>简单看了下报错内容，估计是PDF这个技术更新的太快了，R studio公司的 cheatsheet 用的PDF标准不被PHP的那两个模块支持！</p>
<p>后来我直接用了<strong>pdfjoin Rstudio_cheatsheets/*pdf   这个命令，简单粗暴，一下子就搞定了！</strong></p>
<p>----</p>
<blockquote><p>  pdfjam: This is pdfjam version 2.08.</p>
<p>pdfjam: Reading any site-wide or user-specific defaults...</p>
<p>(none found)</p>
<p>pdfjam: Effective call for this run of pdfjam:</p>
<p>/usr/bin/pdfjam --fitpaper 'true' --rotateoversize 'true' --suffix joined -- Rstudio_cheatsheets/advancedR.pdf - Rstudio_cheatsheets/base-r.pdf - Rstudio_cheatsheets/data-wrangling-cheatsheet.pdf - Rstudio_cheatsheets/devtools-cheatsheet.pdf - Rstudio_cheatsheets/ggplot2-cheatsheet.pdf - Rstudio_cheatsheets/rmarkdown-cheatsheet.pdf - Rstudio_cheatsheets/rmarkdown-reference.pdf - Rstudio_cheatsheets/rstudio-IDE-cheatsheet.pdf - Rstudio_cheatsheets/shiny-cheatsheet.pdf -</p>
<p>pdfjam: Calling pdflatex...</p>
<p><strong>  pdfjam: Finished.  Output was to '/home/jmzeng/tmp/test_php/shiny-cheatsheet-joined.pdf'.</strong></p></blockquote>
<p>但是，格式不怎么正常， 我最后还是推荐用一个网页工具，你直接上传你的PDF，人家马上就给你合并好了，你直接下载即可。</p>
<p>这种技术，玩玩就好，不要深究。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/1673.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
