 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Data_formatting_and_preprocessing</id>
	<title>Data formatting and preprocessing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Data_formatting_and_preprocessing"/>
	<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Data_formatting_and_preprocessing&amp;action=history"/>
	<updated>2026-04-04T18:22:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.8</generator>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Data_formatting_and_preprocessing&amp;diff=5296&amp;oldid=prev</id>
		<title>Wbuytaert at 13:34, 4 June 2008</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Data_formatting_and_preprocessing&amp;diff=5296&amp;oldid=prev"/>
		<updated>2008-06-04T13:34:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:34, 4 June 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot; &gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Linear interpolation==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Linear interpolation==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Remove (short) gaps in a timeseries by linear interpolation&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Remove (short) gaps in a timeseries by linear interpolation&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Make sure your last value is not an NA because then the while loop runs forever.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     for(i in 1:length(timeseries)) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     for(i in 1:length(timeseries)) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
	<entry>
		<id>https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Data_formatting_and_preprocessing&amp;diff=5255&amp;oldid=prev</id>
		<title>Wbuytaert at 13:16, 2 June 2008</title>
		<link rel="alternate" type="text/html" href="https://source.geography.bristol.ac.uk/mediawiki/index.php?title=Data_formatting_and_preprocessing&amp;diff=5255&amp;oldid=prev"/>
		<updated>2008-06-02T13:16:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Projects]]&lt;br /&gt;
[[Category:Hydrology in R]]&lt;br /&gt;
&lt;br /&gt;
These are quick and dirty scripts that often are not very efficient but do their job. &lt;br /&gt;
&lt;br /&gt;
==Linear interpolation==&lt;br /&gt;
&lt;br /&gt;
Remove (short) gaps in a timeseries by linear interpolation:&lt;br /&gt;
&lt;br /&gt;
    for(i in 1:length(timeseries)) {&lt;br /&gt;
        if(is.na(timeseries[i])) {&lt;br /&gt;
            j &amp;lt;- 1&lt;br /&gt;
            while(is.na(timeseries[i+j])) j &amp;lt;- j+1&lt;br /&gt;
            delta &amp;lt;- (timeseries[i+j] - timeseries[i-1]) / (j+1)&lt;br /&gt;
            timeseries[i] &amp;lt;- timeseries[i - 1] + delta&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;/div&gt;</summary>
		<author><name>Wbuytaert</name></author>
	</entry>
</feed>