<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>R on Christian Hotz-Behofsits</title><link>https://hotzbehofsits.com/tags/r/</link><description>Recent content in R on Christian Hotz-Behofsits</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 06 Jan 2021 12:37:52 +0100</lastBuildDate><atom:link href="https://hotzbehofsits.com/tags/r/index.xml" rel="self" type="application/rss+xml"/><item><title>Parallel JSONLines in R</title><link>https://hotzbehofsits.com/post/r_parallel_jsonl/</link><pubDate>Wed, 06 Jan 2021 12:37:52 +0100</pubDate><guid>https://hotzbehofsits.com/post/r_parallel_jsonl/</guid><description>&lt;p&gt;JSON is becoming more and more widely used in data lakes, especially as a replacement for CSV. In particular, JSONLines where one JSON object is stored per line is to be mentioned here. Although the format has some disadvantages (i.e., overhead, supports only few data types), the advantages mostly outweigh them. For example, the individual lines are easier to read by humans and the format is much more standardized. In addition, each line has its own JSON object that can be processed independently. The overhead caused by the repeating field names can be well managed with compression (e.g., gzip, zstd, brotli).&lt;/p&gt;</description></item><item><title>Learning Emoji Representations from Observed Usage</title><link>https://hotzbehofsits.com/post/emoji_embeddings/</link><pubDate>Tue, 05 Nov 2019 21:02:51 +0100</pubDate><guid>https://hotzbehofsits.com/post/emoji_embeddings/</guid><description>&lt;p&gt;Nowadays it is hard to imagine daily communication without emojis like &amp;#x1f604;, &amp;#x1f62c; or &amp;#x2764;&amp;#xfe0f;. These cute pictograms are not only ideal for expressing emotions, they are also standardized. This makes them ideal for analysis. However, before classical analyses such as clustering can be performed, a numerical representation is required. A simple method would be one-hot-encoding, which would be obvious considering the very limited vocabulary (there are only a few thousand emojis). However, embeddings can not only provide more memory friendly representations, but also those that capture a meaning.&lt;/p&gt;</description></item><item><title>Recommender Systems in R</title><link>https://hotzbehofsits.com/post/recommender-systems-r/</link><pubDate>Sat, 26 Oct 2019 20:59:29 +0200</pubDate><guid>https://hotzbehofsits.com/post/recommender-systems-r/</guid><description>&lt;p&gt;A former WU-member, Michael Hahsler, created a really nice package called recommenderlab, which allows you to build collaborative filtering systems. But before you can use it, you have to install all required packages:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;install.packages(c(&amp;#34;recommenderlab&amp;#34;, &amp;#34;dplyr&amp;#34;, &amp;#34;readr&amp;#34;))
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;hellip; and load them:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-r" data-lang="r"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;library&lt;/span&gt;(recommenderlab)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;library&lt;/span&gt;(tibble)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;library&lt;/span&gt;(dplyr)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;library&lt;/span&gt;(readr)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I asked my students to answer some questions. One question was about their favourite TV series, which is a good example for a recommender system &lt;em&gt;(Netflix for example does pretty much the same)&lt;/em&gt;. So they filled out this survey and I generated a table by adding a new row for each student and a new column for each TV show. I put a 1 in the cell if the user likes the show and nothing if not. You can import such a table &lt;em&gt;(CSV-format)&lt;/em&gt; using the following command &lt;em&gt;(all columns are by default parsed as integers except user, which is a string)&lt;/em&gt;. The file itself came from a course survey and is not published here, so you will have to substitute your own:&lt;/p&gt;</description></item><item><title>Using Embeddings in R</title><link>https://hotzbehofsits.com/post/embeddings_in_r/</link><pubDate>Thu, 08 Aug 2019 21:24:40 +0200</pubDate><guid>https://hotzbehofsits.com/post/embeddings_in_r/</guid><description>&lt;p&gt;There exist different file formats to store distributed vector or word representations also known as embeddings. However, one of the most convenient ways is to use the text format used by the original word2vec implementation. In this format, each row starts with a label (an item of the vocabulary) followed by the vector components. Furthermore, each field is separated by an ordinary space. The following function processes such *.vec-files and can be used to load them directly into R:&lt;/p&gt;</description></item></channel></rss>