<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>[time-stamped.blog]</title>
<link>https://www.time-stamped.blog/</link>
<atom:link href="https://www.time-stamped.blog/index.xml" rel="self" type="application/rss+xml"/>
<description>Data about Early Christianity</description>
<generator>quarto-1.9.38</generator>
<lastBuildDate>Thu, 06 Aug 2026 07:00:00 GMT</lastBuildDate>
<item>
  <title>Small Steps</title>
  <dc:creator>AJ </dc:creator>
  <link>https://www.time-stamped.blog/posts/small_steps/</link>
  <description><![CDATA[ 





<section id="pulling-in-my-lost-data" class="level1">
<h1>Pulling in my “Lost” Data</h1>
<p>In my last post, I talked about finding and reviving my early Christianity data. Joyous occasion! Now I need to bring it in to RStudio.</p>
<p>My data is currently in several JSON files, which have been uploaded to a <a href="https://github.com/timestamped-blog/blog-code-ver-usagi">project space in Github</a>. If you pull down that project and all of the files, then this code should work perfectly using the “here” package. The here package allows R to reference and construct file paths relative to where the project is saved, or the working directory you are working from. It has been a godsend since I have moved to using Quarto, where working inside project spaces is essential to making sure everything works and compiles correctly. It also makes working with Github much easier. Let’s take a look!</p>
<p>Before anything, you need your packages. The following code loads the required packages for this script, which include the aforementioned <a href="https://cran.r-project.org/web/packages/here/vignettes/here.html">here</a>, the always-essential <a href="https://tidyverse.org/">tidyverse</a>, and <a href="https://cran.r-project.org/web/packages/jsonlite/refman/jsonlite.html#flatten">jsonlite</a>, which will be used for loading and flattening the JSON files. I have included (commented-out) lines for installing those packages if you don’t already have them.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#install.packages("here")</span></span>
<span id="cb1-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#install.packages("tidyverse")</span></span>
<span id="cb1-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#install.packages("jsonlite")</span></span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Load libraries</span></span>
<span id="cb1-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(here)</span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb1-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(jsonlite)</span></code></pre></div></div>
</div>
<p>In my case, I have the project, referred to as “blog-code-ver-usagi”, saved to a folder on my D: drive called “Early Xty”. When I call the <code>here()</code> function, it returns the path <code>"D:/Early Xty/github/blog-code-ver-usagi"</code>. Accessing the folders inside the path is easy, just enter the name of the desired folder inside quotes.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">here</span>()</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "D:/Early Xty/github/blog-code-ver-usagi"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">here</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"raw_data_files"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "D:/Early Xty/github/blog-code-ver-usagi/raw_data_files"</code></pre>
</div>
</div>
<p>I want to read in all of my files in at one time, and give them a name based on the file I read them from. I also want to apply jsonlite’s <code>flatten</code> to each of them. My JSON files are simple, with only 1 level of data, so <code>flatten</code> will easily convert each file into a simple, tabulated data frame.</p>
<p>A simple loop will give me exactly what I want. Below this chunk is a detailed explanation of what I am doing in each numbered step.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#1</span></span>
<span id="cb6-2">raw_data_dir <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">here</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"raw_data_files"</span>)</span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#2</span></span>
<span id="cb6-4">raw_data_file_names <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list.files</span>(raw_data_dir)</span>
<span id="cb6-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#3</span></span>
<span id="cb6-6"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> (i <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> raw_data_file_names) {</span>
<span id="cb6-7">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#4</span></span>
<span id="cb6-8">  current_file <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">fromJSON</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">file.path</span>(</span>
<span id="cb6-9">    raw_data_dir,</span>
<span id="cb6-10">    i</span>
<span id="cb6-11">  ), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">flatten =</span> T)</span>
<span id="cb6-12">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#5</span></span>
<span id="cb6-13">  simple_name <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> i <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb6-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">str_remove</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">".json"</span>)</span>
<span id="cb6-15">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#6</span></span>
<span id="cb6-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">assign</span>(simple_name, current_file)</span>
<span id="cb6-17">}</span></code></pre></div></div>
</div>
<section id="what-am-i-doing-here" class="level2">
<h2 class="anchored" data-anchor-id="what-am-i-doing-here">What am I doing here?</h2>
<ol type="1">
<li>I created an object that contained the file path to where the raw files live and called it <code>raw_data_files</code>.</li>
<li>Using the base-R function <code>list.files()</code>, I created a vector with all of the file names that are in <code>raw_data_files</code> called <code>raw_data_file_names</code>.</li>
<li>I invoke the loop with <code>for (i in raw_data_file_names)</code>, followed by curly brackets <code>{}</code>. The code inside the brackets is applied to <code>i</code> - or the current value being used in whatever set you have fed into the <code>for ()</code>. You can actually use any letter you like - it is simply a placeholder inside your function. Not unlike “x” or “y” in a mathematical formula. Here, I am asking R to look at each item in <code>raw_data_file_names</code> vector.</li>
<li>Now the magic inside the loop’s curly brackets begins.<br> I apply the <code>fromJSON()</code> function to read the .json file. Inside the parenthesis in <code>fromJSON()</code>, <code>file.path()</code> tells R that I am putting together a file path based on the previously-constructed objects, inside of those parenthesis. In this case it is the <code>raw_data_dir</code> (which points to <code>D:/Early Xty/github/blog-code-ver-usagi/raw_data_files</code>) and <code>i</code>, which is the current value/file name in the vector, <code>raw_data_file_names</code>. This creates a complete file path that <code>fromJSON()</code> can read. After the file path, I apply the <code>flatten</code> with <code>flatten = T</code>. I ask that it store the file it is reading in to an object called <code>current_file</code>. With each iteration over the files in the loop, this object will be overwritten with whatever file is being referenced with <code>i</code>.</li>
<li>Because of that, we need to rename the set when the data has been loaded, and I think the self-descriptive names of the files work the best. So, again using the current value of <code>i</code>, I use the <a href="https://stringr.tidyverse.org/">stringr</a> command <code>str_remove()</code> to strip out the <code>".json"</code> part of the file name, and leave me with just the simple name. For example: <code>structures.json</code> becomes <code>structures</code>.</li>
<li>Base-R function <code>assign()</code> lets me use that <code>simple_name</code> to name the <code>current_file</code>.</li>
</ol>
<p>The loop will perform these steps for every file listed in <code>raw_data_file_names</code>, until it reaches the end of the vector. As a result, your Environment should show an object for every file, each name with the simplified name of that same file. If you did it right, you should see something like this:</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://www.time-stamped.blog/posts/small_steps/r_env.PNG" title="R Environment" class="img-fluid figure-img"></p>
<figcaption>R Environment after reading in JSON files</figcaption>
</figure>
</div>
<p>Loops are incredibly handy for any code you want to apply repeatedly to a set of things. You just need to be sure you have that set of things stored somewhere, or otherwise accessible in your Environment. My example is very simple and straightforward, because that is what I needed, but you can get very fancy using them!</p>
<p>Now my data is loaded and ready to party.</p>


</section>
</section>

 ]]></description>
  <category>code</category>
  <category>JSON</category>
  <guid>https://www.time-stamped.blog/posts/small_steps/</guid>
  <pubDate>Thu, 06 Aug 2026 07:00:00 GMT</pubDate>
  <media:content url="https://www.time-stamped.blog/posts/small_steps/tracy.png" medium="image" type="image/png" height="73" width="144"/>
</item>
<item>
  <title>Reboot</title>
  <dc:creator>AJ </dc:creator>
  <link>https://www.time-stamped.blog/posts/reboot/</link>
  <description><![CDATA[ 





<center>
<img src="https://www.time-stamped.blog/posts/reboot/ami-usagi.png" alt="Upset, screaming Ami grabbing Usagi" width="50%">
</center>
<p>
</p><p>About 18 months ago, I started this blog with the intention of creating a site that was part-tutorial/how-tos, part-data exploration, and part-coding practice. Things were going pretty well! Then the hard drive where I stored everything died. This wiped out all of my files associated with my early Christianity project, including my main source file, which I had been adding to for years! It also took my 15-year Sim City game and my mods with it - but that’s another sad story for another time. The loss of my files also killed my motivation to work on my data. I had scraps of work here and there, but a lot of my major work was lost. It was all very heartbreaking.</p>
<p>Then, one day I was looking for something completely unrelated on my main C: drive, and saw that I still had MySQL installed. Before my other drive died, I had installed MySQL and imported my data into it so that I could get into practicing SQL again. I had even added some new records and done a ton of cleanup that had not made it in my original source files. I could have sworn MySQL was installed on the dead drive, but here it was, in all of its un-deleted glory.</p>
<p>I decided to export all of the data, in its current state, into JSON files and upload that to my Github project space. Protecting it from future disaster, and making it available to everyone. I had divided my data up into separate tables, and linked them together using a UUID, which is how the files are now structured on my computer and on Github. All of that raw data can be found here: <a href="https://github.com/timestamped-blog/blog-code-ver-usagi/tree/master/raw_data_files">timestamped-blog - raw_data_files</a>.</p>
<p>I also found the motivation to reboot my blog. Going forward, I am going to use Quarto to create my site. It is quickly becoming the standard for document publishing in my job, and I am going to take this opportunity to learn more about it and how it can be used. I also find it a lot more intuitive than WordPress, and I can keep all my code, files, and content in one happy ecosystem.</p>
<p>My site’s source code can be found and downloaded here: <a href="https://github.com/timestamped-blog/blog-code-ver-usagi" class="uri">https://github.com/timestamped-blog/blog-code-ver-usagi</a></p>
<p><span style="font-size:0.6em;"> Pic from episode #55 of Sailor Moon. I am Ami, and Usagi is my dead hard drive. </span></p>



 ]]></description>
  <category>github</category>
  <category>general updates</category>
  <guid>https://www.time-stamped.blog/posts/reboot/</guid>
  <pubDate>Sun, 02 Aug 2026 07:00:00 GMT</pubDate>
  <media:content url="https://www.time-stamped.blog/posts/reboot/ami-usagi.png" medium="image" type="image/png" height="109" width="144"/>
</item>
</channel>
</rss>
