<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: An R Package by a CA Reader Solves the Z Problem</title>
	<atom:link href="http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/</link>
	<description>by Steve McIntyre</description>
	<lastBuildDate>Sat, 25 May 2013 05:25:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Henry</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150872</link>
		<dc:creator><![CDATA[Henry]]></dc:creator>
		<pubDate>Sun, 15 Feb 2009 03:08:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150872</guid>
		<description><![CDATA[Just to note there is an unhelpful space in the first line of the example code with an erroneous &quot;&lt; -&quot; which should be &quot;&lt;-&quot;.

Pedantically, I would also tend to avoid having &quot;data&quot; and &quot;Data&quot; around at the same time meaning different things, and stylistically either &quot;&lt;-&quot; or &quot;=&quot; should be used throughout, so perhaps as a model the code could be
&lt;blockquote&gt;handle &lt;- url(&quot;ftp://ftp.ncdc.noaa.gov/pub/data/ushcn/station.inventory.Z&quot;, &quot;rb&quot;)
raw_data &lt;- readBin(handle, &quot;raw&quot;, 9999999)
close(handle)
uncomp_data &lt;- uncompress(raw_data)
Data &lt;- strsplit(rawToChar(uncomp_data), &quot;\n&quot;)
Data &lt;- unlist(Data)
&lt;/blockquote&gt;

More seriously, I do not seem to get the whole NOAA file into Data, as it breaks at records 143 or 458 depending how I run the code. Copying the file to my hard disk first, it breaks at record 1222.]]></description>
		<content:encoded><![CDATA[<p>Just to note there is an unhelpful space in the first line of the example code with an erroneous &#8220;&lt; -&#8221; which should be &#8220;&lt;-&#8221;.</p>
<p>Pedantically, I would also tend to avoid having &#8220;data&#8221; and &#8220;Data&#8221; around at the same time meaning different things, and stylistically either &#8220;&lt;-&#8221; or &#8220;=&#8221; should be used throughout, so perhaps as a model the code could be</p>
<blockquote><p>handle &lt;- url(&#8220;ftp://ftp.ncdc.noaa.gov/pub/data/ushcn/station.inventory.Z&#8221;, &#8220;rb&#8221;)<br />
raw_data &lt;- readBin(handle, &#8220;raw&#8221;, 9999999)<br />
close(handle)<br />
uncomp_data &lt;- uncompress(raw_data)<br />
Data &lt;- strsplit(rawToChar(uncomp_data), &#8220;\n&#8221;)<br />
Data &lt;- unlist(Data)
</p></blockquote>
<p>More seriously, I do not seem to get the whole NOAA file into Data, as it breaks at records 143 or 458 depending how I run the code. Copying the file to my hard disk first, it breaks at record 1222.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150871</link>
		<dc:creator><![CDATA[Nicholas]]></dc:creator>
		<pubDate>Thu, 12 Jun 2008 22:30:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150871</guid>
		<description><![CDATA[Slartibartfast : Does it work if you double up the backslashes, in order to escape them?

Anyway the bigger problem with calling external programs, besides inconvenience and performance, is that we (and specifically Mr. McIntyre, I think) want these scripts to be reproducible. If you&#039;re executing an external program it requires the user to have that program installed in the same place as you do, and then you have to deal with the case where the program may be executing on different operating systems.

However, with this R package, all a user has to do is install it via CRAN, whether they are using Linux, Windows, MacOS, or some other Unix variant. It should just work. If it doesn&#039;t hopefully they will let me know and I can fix it.

If there&#039;s another processing step required for external data in future which is hard to perform in R then I can write another package to deal with it. Hopefully we can reach a point where practically all climate data is easily imported into R for processing. We may already be close to that point.]]></description>
		<content:encoded><![CDATA[<p>Slartibartfast : Does it work if you double up the backslashes, in order to escape them?</p>
<p>Anyway the bigger problem with calling external programs, besides inconvenience and performance, is that we (and specifically Mr. McIntyre, I think) want these scripts to be reproducible. If you&#8217;re executing an external program it requires the user to have that program installed in the same place as you do, and then you have to deal with the case where the program may be executing on different operating systems.</p>
<p>However, with this R package, all a user has to do is install it via CRAN, whether they are using Linux, Windows, MacOS, or some other Unix variant. It should just work. If it doesn&#8217;t hopefully they will let me know and I can fix it.</p>
<p>If there&#8217;s another processing step required for external data in future which is hard to perform in R then I can write another package to deal with it. Hopefully we can reach a point where practically all climate data is easily imported into R for processing. We may already be close to that point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slartibartfast</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150870</link>
		<dc:creator><![CDATA[Slartibartfast]]></dc:creator>
		<pubDate>Thu, 12 Jun 2008 18:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150870</guid>
		<description><![CDATA[&lt;blockquote&gt;It turns out that you can run DOS commands out of R by using the system() command.&lt;/blockquote&gt;

Sure, but just &lt;em&gt;try&lt;/em&gt; and call a Cygwin executable using system() from Microsoft C++ .NET...and passing it a filename, including path, as an argument.  Recalling, of course, that DOS wants to use backslash in path descriptors, but Cygwin treats backslash as an escape.]]></description>
		<content:encoded><![CDATA[<blockquote><p>It turns out that you can run DOS commands out of R by using the system() command.</p></blockquote>
<p>Sure, but just <em>try</em> and call a Cygwin executable using system() from Microsoft C++ .NET&#8230;and passing it a filename, including path, as an argument.  Recalling, of course, that DOS wants to use backslash in path descriptors, but Cygwin treats backslash as an escape.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150869</link>
		<dc:creator><![CDATA[Nicholas]]></dc:creator>
		<pubDate>Wed, 11 Jun 2008 04:51:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150869</guid>
		<description><![CDATA[OK, interestingly, what seems to happen is that if you use gzfile on a .Z file, it doesn&#039;t complain or fail in any way, but the data you get back appears to be the raw compressed data - i.e. exactly what you get if you use file().

Observe:


&gt; handle &lt;- gzfile(&quot;IMMA.1784.02.Z&quot;, &quot;rb&quot;);
&gt; data &lt;- readBin(handle, &quot;raw&quot;, 9999999999);
&gt; close(handle);
&gt; rawToChar(data)
[1] &quot;37\235\2201n\340\24001B\206\f\202...
&gt; library(&quot;uncompress&quot;);
&gt; rawToChar(uncompress(data));
[1] &quot;1784 224     3913 28782 02 4    10EMPRE*_C   1 23...
&gt;


I think what is happening is the commandline program &quot;gzip&quot; can handle .Z data but not via zlib - it uses separate code - and gzfile() uses zlib. However that&#039;s just a guess. I&#039;m pretty sure I tried this before I wrote the uncompress package since I was trying to find the easiest way to solve this problem :)]]></description>
		<content:encoded><![CDATA[<p>OK, interestingly, what seems to happen is that if you use gzfile on a .Z file, it doesn&#8217;t complain or fail in any way, but the data you get back appears to be the raw compressed data &#8211; i.e. exactly what you get if you use file().</p>
<p>Observe:</p>
<p>&gt; handle &lt;- gzfile(&#8220;IMMA.1784.02.Z&#8221;, &#8220;rb&#8221;);<br />
&gt; data &lt;- readBin(handle, &#8220;raw&#8221;, 9999999999);<br />
&gt; close(handle);<br />
&gt; rawToChar(data)<br />
[1] &#8220;37\235\2201n\340\24001B\206\f\202&#8230;<br />
&gt; library(&#8220;uncompress&#8221;);<br />
&gt; rawToChar(uncompress(data));<br />
[1] &#8220;1784 224     3913 28782 02 4    10EMPRE*_C   1 23&#8230;<br />
&gt;</p>
<p>I think what is happening is the commandline program &#8220;gzip&#8221; can handle .Z data but not via zlib &#8211; it uses separate code &#8211; and gzfile() uses zlib. However that&#8217;s just a guess. I&#8217;m pretty sure I tried this before I wrote the uncompress package since I was trying to find the easiest way to solve this problem <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150868</link>
		<dc:creator><![CDATA[Nicholas]]></dc:creator>
		<pubDate>Wed, 11 Jun 2008 04:44:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150868</guid>
		<description><![CDATA[I think I tried that and it didn&#039;t work, but I can try it again. I believe you&#039;d have to download the file to the hard disk since I don&#039;t think gzfile works with URLs.

The Mac OSX version of my package is available now too. I believe that means &quot;uncompress&quot; will run on any platform that R will, unless I&#039;ve made a mistake with Unix portability. I haven&#039;t tested it on 64 bit, but theoretically it should work.

The packages are here:

&lt;a href=&quot;http://cran.r-project.org/web/packages/uncompress/index.html&quot; rel=&quot;nofollow&quot;&gt;http://cran.r-project.org/web/packages/uncompress/index.html&lt;/a&gt;

I&#039;ll check again if gzfile will open .Z files - as I said I don&#039;t think so - but I&#039;ll report on the result.]]></description>
		<content:encoded><![CDATA[<p>I think I tried that and it didn&#8217;t work, but I can try it again. I believe you&#8217;d have to download the file to the hard disk since I don&#8217;t think gzfile works with URLs.</p>
<p>The Mac OSX version of my package is available now too. I believe that means &#8220;uncompress&#8221; will run on any platform that R will, unless I&#8217;ve made a mistake with Unix portability. I haven&#8217;t tested it on 64 bit, but theoretically it should work.</p>
<p>The packages are here:</p>
<p><a href="http://cran.r-project.org/web/packages/uncompress/index.html" rel="nofollow">http://cran.r-project.org/web/packages/uncompress/index.html</a></p>
<p>I&#8217;ll check again if gzfile will open .Z files &#8211; as I said I don&#8217;t think so &#8211; but I&#8217;ll report on the result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OldUnixHead</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150867</link>
		<dc:creator><![CDATA[OldUnixHead]]></dc:creator>
		<pubDate>Tue, 10 Jun 2008 21:07:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150867</guid>
		<description><![CDATA[Follow-on to #6:

Re-attempting to show the code that got cut off:

Following your example, is something like the following possible without requiring the addition of a package?


...
handle &lt;- url(&quot;ftp://ftp.ncdc.noaa.gov/pub/data/ushcn/station.inventory.Z&quot;, &quot;rb&quot;)
uncomp_data &lt;- gzfile(handle)
close(handle)
Data &lt;- strsplit(rawToChar(uncomp_data), &quot;\n&quot;)
...

&lt;strong&gt;Steve: &lt;/strong&gt;  gzfile does gz files, not Z files.  That&#039;s why the package ws necessary. My guess is that Nicholas&#039; function will ultimately be added into the base R along with gzfile and such.]]></description>
		<content:encoded><![CDATA[<p>Follow-on to #6:</p>
<p>Re-attempting to show the code that got cut off:</p>
<p>Following your example, is something like the following possible without requiring the addition of a package?</p>
<p>&#8230;<br />
handle &lt;- url(&#8220;ftp://ftp.ncdc.noaa.gov/pub/data/ushcn/station.inventory.Z&#8221;, &#8220;rb&#8221;)<br />
uncomp_data &lt;- gzfile(handle)<br />
close(handle)<br />
Data &lt;- strsplit(rawToChar(uncomp_data), &#8220;\n&#8221;)<br />
&#8230;</p>
<p><strong>Steve: </strong>  gzfile does gz files, not Z files.  That&#8217;s why the package ws necessary. My guess is that Nicholas&#8217; function will ultimately be added into the base R along with gzfile and such.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OldUnixHead</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150866</link>
		<dc:creator><![CDATA[OldUnixHead]]></dc:creator>
		<pubDate>Tue, 10 Jun 2008 20:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150866</guid>
		<description><![CDATA[Apologies in advance if you folks have already tried this (and I&#039;m barely passing-familiar with &#039;R&#039;), but, if &#039;R&#039;s internal code for gzfile() used the complete set of gzip&#039;s/gunzip&#039;s &#039;magic number&#039;-recognition and decoding functionality, it might be able to parse &#039;.Z&#039; files automatically.

Following your example, is something like the following possible without requiring the addition of a package?

...
handle]]></description>
		<content:encoded><![CDATA[<p>Apologies in advance if you folks have already tried this (and I&#8217;m barely passing-familiar with &#8216;R&#8217;), but, if &#8216;R&#8217;s internal code for gzfile() used the complete set of gzip&#8217;s/gunzip&#8217;s &#8216;magic number&#8217;-recognition and decoding functionality, it might be able to parse &#8216;.Z&#8217; files automatically.</p>
<p>Following your example, is something like the following possible without requiring the addition of a package?</p>
<p>&#8230;<br />
handle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Not sure</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150865</link>
		<dc:creator><![CDATA[Not sure]]></dc:creator>
		<pubDate>Mon, 09 Jun 2008 23:26:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150865</guid>
		<description><![CDATA[As is the case with many things Unix, the tale of &lt;em&gt;compress&lt;/em&gt; &lt;a href=&quot;http://www.kyzer.me.uk/essays/giflzw/&quot; rel=&quot;nofollow&quot;&gt;is long and sordid.&lt;/a&gt;]]></description>
		<content:encoded><![CDATA[<p>As is the case with many things Unix, the tale of <em>compress</em> <a href="http://www.kyzer.me.uk/essays/giflzw/" rel="nofollow">is long and sordid.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150864</link>
		<dc:creator><![CDATA[Nicholas]]></dc:creator>
		<pubDate>Mon, 09 Jun 2008 16:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150864</guid>
		<description><![CDATA[By the way Steve, what you might be able to do in the case of gzip is put the gzpi.exe an gunzip.exe somewhere in your system &quot;path&quot;, then you won&#039;t need to append the &quot;d:/Documents/&quot; to it each time.

It&#039;s possible to add locations to the path via, I believe, Control Panel&#039;s &quot;System&quot; panel. However personally I&#039;m lazy and I usually just copy such files into C:\WINNT\SYSTEM32 (or C:\WINDOWS\SYSTEM32 as appropriate). Then you can run them from anywhere.

Of course R has gzfile() so in this case it isn&#039;t strictly necessary, but there may be other times you need to execute an external program. Then again, now that I know how to make R packages, it should be less necessary :)

&lt;strong&gt;
Steve: &lt;/strong&gt;I was just using gzip to experiment with the system() command on something that worked (my interest then being in the compress.exe command), not because I was having trouble with gz files.]]></description>
		<content:encoded><![CDATA[<p>By the way Steve, what you might be able to do in the case of gzip is put the gzpi.exe an gunzip.exe somewhere in your system &#8220;path&#8221;, then you won&#8217;t need to append the &#8220;d:/Documents/&#8221; to it each time.</p>
<p>It&#8217;s possible to add locations to the path via, I believe, Control Panel&#8217;s &#8220;System&#8221; panel. However personally I&#8217;m lazy and I usually just copy such files into C:\WINNT\SYSTEM32 (or C:\WINDOWS\SYSTEM32 as appropriate). Then you can run them from anywhere.</p>
<p>Of course R has gzfile() so in this case it isn&#8217;t strictly necessary, but there may be other times you need to execute an external program. Then again, now that I know how to make R packages, it should be less necessary <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><br />
Steve: </strong>I was just using gzip to experiment with the system() command on something that worked (my interest then being in the compress.exe command), not because I was having trouble with gz files.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: austin</title>
		<link>http://climateaudit.org/2008/06/09/an-r-package-by-a-ca-reader-solves-the-z-problem/#comment-150863</link>
		<dc:creator><![CDATA[austin]]></dc:creator>
		<pubDate>Mon, 09 Jun 2008 16:24:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.climateaudit.org/?p=3170#comment-150863</guid>
		<description><![CDATA[I once offered use of a private cluster and modern database to a researcher for free after seeing the horrible tools and methods he was using. At first he was elated, then when he realized he could do a year&#039;s worth of work in a day, he backed off, because &quot;No one will be able to reproduce my results.&quot;

The private sector runs rings around most other institutions.]]></description>
		<content:encoded><![CDATA[<p>I once offered use of a private cluster and modern database to a researcher for free after seeing the horrible tools and methods he was using. At first he was elated, then when he realized he could do a year&#8217;s worth of work in a day, he backed off, because &#8220;No one will be able to reproduce my results.&#8221;</p>
<p>The private sector runs rings around most other institutions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
