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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:23:34+00:00 2026-06-17T20:23:34+00:00

I have the following very simple R script which uses zoo to visualize daily

  • 0

I have the following very simple R script which uses zoo to visualize daily numbers on a timeline:

# Small script to plot daily number of added users to database
library(zoo)

data <- read.csv("search_history.csv", header=FALSE)
# last line will be cut because it might be incomplete
zoodata <- data[1:(length(data$V2)-1), ]
series <- zoo(zoodata$V2, zoodata$V1)

par(mar=c(7, 6, 4, 2), 
    lab=c(5, 6, 5), 
    mgp = c(4, 1, 0))

plot(series,
     main="Number of users added to database over time", 
     xlab="Date", 
     ylab="Number of users",
     las=2,
     lwd=2,
     col="red",
     cex.axis=0.7)

Content of search_history.csv:

"2012-12-27","458","4728"
"2012-12-28","239","6766"
"2012-12-29","193","8189"
"2012-12-30","148","7698"
"2012-12-31","137","7370"
"2013-01-01","119","6324"
"2013-01-02","122","7016"
"2013-01-03","115","7986"
"2013-01-04","112","8222"
"2013-01-05","112","6828"
"2013-01-06","124","7318"
"2013-01-07","121","8228"
"2013-01-08","120","8158"
...

I want to visualize the first (V1) and the second column (V2). I basically have two problems: The first and obvious one are the dashed lines at y-Position ~50 and ~450. How can I remove them and why are they even included?

The second problem is the inclusion of 2013-01-26 in the x-Axis. As you can see, I removed the last line of the dataset which contains this data (like an amateur, maybe there is a better way to do this). So the plot should not include the last date. I don’t understand why it even knows about this date since it takes zoodata as input, not data.
my plot

  • 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-17T20:23:35+00:00Added an answer on June 17, 2026 at 8:23 pm

    Two things: Your strings are being read as factors, and you are indexing your zoo object by a character vector instead of by Dates.

    If you include stringsAsFactors=FALSE in your read.csv call and give your zoo object a Date index it will look more like you were expecting.

    library(zoo)    
    data <- read.csv(text='"2012-12-27","458","4728"
                     "2012-12-28","239","6766"
                     "2012-12-29","193","8189"
                     "2012-12-30","148","7698"
                     "2012-12-31","137","7370"
                     "2013-01-01","119","6324"
                     "2013-01-02","122","7016"
                     "2013-01-03","115","7986"
                     "2013-01-04","112","8222"
                     "2013-01-05","112","6828"
                     "2013-01-06","124","7318"
                     "2013-01-07","121","8228"
                     "2013-01-08","120","8158"', header=FALSE, 
                     stringsAsFactors=FALSE)
    
    zoodata <- data[1:(length(data$V2)-1), ]
    series <- zoo(zoodata$V2, as.Date(zoodata$V1))
    
    par(mar=c(7, 6, 4, 2), 
        lab=c(5, 6, 5), 
        mgp = c(4, 1, 0))
    
    plot(series,
         main="Number of users added to database over time", 
         xlab="Date", 
         ylab="Number of users",
         las=2,
         lwd=2,
         col="red",
         cex.axis=0.7)
    

    Which produces:

    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 have the following very simple Ext JS 4 script which is supposed to
Let's say I have the following, very simple block of code: <script> function hasVal(field)
I have the following very simple code snippet which is loaded from a separate
I have a very simple table called Member , which consists of the following:
I have the following simple script, which I am using to dynamically create the
I have a very simple script that uses Copy-Item in the Task Build section
I have got the following very simple code: function init() { var articleTabs =
I have the following PHP code doing a very simple select into a table.
I have a very simple html page with the following javascript in it $(function()
I have a very simple Mapping I'm trying to do. I'm following the NHibernate

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.