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 8475859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:00:44+00:00 2026-06-10T18:00:44+00:00

I need to plot a time series in R. But having a tough time

  • 0

I need to plot a time series in R. But having a tough time to figure out how to work with the formats.

dates <- c(20060901, 20060905, 20060906, 20060907, 20060908, 20060911)
values <- c(33.6, 32.0, 30.0, 30.0, 30.0, 28.4)

Need to convert the dates in proper Format E.g: 20060901 to Sep-01-2006 and so on

My approach so far:

dates = as.Date(dates, "%Y%m%d")
plot(dates , values)

However, I get the following error :

Error in charToDate(x) : character string is not in a standard unambiguous format
  • 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. Editorial Team
    Editorial Team
    2026-06-10T18:00:45+00:00Added an answer on June 10, 2026 at 6:00 pm

    You probably want to read some basic docs to learn more about basic types, but here is a worked example using your data:

    R> data <- data.frame(dates=as.Date(as.character(c(20060901,20060905,20060906, 
    +                                                  20060907,20060908,20060911)), 
    +                                   "%Y%m%d"), 
    +                     values=c(33.6, 32.0, 30.0, 30.0, 30.0, 28.4))
    R> data
           dates values
    1 2006-09-01   33.6
    2 2006-09-05   32.0
    3 2006-09-06   30.0
    4 2006-09-07   30.0
    5 2006-09-08   30.0
    6 2006-09-11   28.4
    R> class(data[,1])
    [1] "Date"
    R> plot(data)
    

    which yields

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to plot a time series with ggplot2. For each point of the
I need to plot a number of time series of different frequencies in R,
I need to plot some discrete predictions with probability intervals in ggplot2, but I'm
I'm having data as like below. I need to plot graph based on region.
I need to read and plot data in real time from multiple Android phones
I need to plot the transformation of a 3d object against time. I have
I'm trying to plot a time series for the last 2 hours, just a
I need to write an application in VB6 which makes a scatter plot out
I need to create a figure window with two plots at the same time.
I need plot a curve for my data , the source is like :

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.