Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 119319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:38:03+00:00 2026-05-11T03:38:03+00:00

I have imported a time series with dates of the following format: test =

  • 0

I have imported a time series with dates of the following format:

 test = c('11-Feb-01','12-Feb-01','01-Mai-08') 

This yields:

> as.Date(test, '%d-%b-%y') [1] NA           NA           '2008-05-01' 

Since, May was translated it obviously takes locale into account.

According to the docs, the %b should be the abbreviated month name, but I guess there’s might be some issue there.

How would I go about fixing this?

I’m running R under Linux t2.6.27-9-generic #1 SMP


Update: Digging a bit deeper i find that the issue is in the LC_TIME definition, where the appropriate abbrivations are of the form:

'jan.','feb.','mars', 'apr', 'mai', 'juni', 'juli', 'aug.','sep.','okt.','nov.', 'des.' 

while my data contains:

'Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des' 

I guess I could consider pre-processing the data, but a smooth way of doing this in R would be most welcome.


This works sort-of, but not so elegant:

> as.Date(gsub('Feb','feb.',test), '%d-%b-%y') [1] '2001-02-11' '2008-02-12' '2008-05-01' 

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:38:04+00:00Added an answer on May 11, 2026 at 3:38 am

    The closest thing I’ve found to a solution is to make multiple iterations over the data to replace the names of the months with something that can be parsed.

    I’m not sure if this is the best solution.

    setwd('/home/tovare/Data')  v <- read.csv2('valuta_dag.sdv',    na.strings = c('NA','ND'),    header = TRUE, sep=';', skip=2)  v$Dato <- gsub('Jan','01',v$Dato) v$Dato <- gsub('Feb','02',v$Dato) v$Dato <- gsub('Mar','03',v$Dato) v$Dato <- gsub('Apr','04',v$Dato) v$Dato <- gsub('Mai','05',v$Dato) v$Dato <- gsub('Jun','06',v$Dato) v$Dato <- gsub('Jul','07',v$Dato) v$Dato <- gsub('Aug','08',v$Dato) v$Dato <- gsub('Sep','09',v$Dato) v$Dato <- gsub('Okt','10',v$Dato) v$Dato <- gsub('Nov','11',v$Dato) v$Dato <- gsub('Des','12',v$Dato)  v$Dato <- as.Date(v$Dato,'%d-%m-%y') 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've imported some data from a CSV file in matlab. They are time series
I have been setting up builds for quite some time now. To do this,
I have a string field in Mysql (date fields imported from from MSSQL) and
Got this error for the first time, I have looked around and cannot find
Based on this example I have imported the VLC ActiveX. When I try to
I have been scratching my head on this one for some time now and
I have xml files been imported onto an FTP server. This is stored in
I have imported video FLV Player(with no skin) in layer(flv1) The flv Player instance
i have imported a c++ native dll method in c#. below is how the
I have imported a JSF/Facelets project from SVN into Netbeans. Any change which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.