<?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 Jose Castrillo</title>
    <link>https://jose.castrillo.eu/tags/r/</link>
    <description>Recent content in R on Jose Castrillo</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 01 Apr 2019 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://jose.castrillo.eu/tags/r/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Parsing date format from .xlsx to R</title>
      <link>https://jose.castrillo.eu/post/r-parse-post/</link>
      <pubDate>Mon, 01 Apr 2019 00:00:00 +0000</pubDate>
      <guid>https://jose.castrillo.eu/post/r-parse-post/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Version:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;platform x86_64-redhat-linux-gnu&lt;br&gt;
arch x86_64&lt;br&gt;
os linux-gnu&lt;br&gt;
system x86_64, linux-gnu
version.string R version 3.5.3 (2019-03-11)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Library&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;lubridate&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Parse method&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash; &lt;em&gt;as.factor&lt;/em&gt; &amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mydata$FECHA_NACIMIENTO&amp;lt;-as.factor(mydata$FECHA_NACIMIENTO)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash; &lt;em&gt;variable for strptime&lt;/em&gt; &amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;tempo&amp;lt;-strptime(mydata$FECHA_NACIMIENTO,&amp;#34;%d/%m/%Y&amp;#34;)
mydata$FECHA_NACIMIENTO&amp;lt;-as.Date(tempo,&amp;#34;%d/%m/%Y&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash; &lt;em&gt;clean variable&lt;/em&gt; &amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;rm (tempo)
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mydata$FECHA_NACIMIENTO &amp;lt;- format(as.Date(mydata$FECHA_NACIMIENTO), &amp;#34;%d/%m/%Y&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash; &lt;em&gt;parsing data&lt;/em&gt; &amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&amp;mdash;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;library(lubridate)
mydata$FECHA_NACIMIENTO &amp;lt;-dmy(mydata$FECHA_NACIMIENTO)
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
  </channel>
</rss>
