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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:58:40+00:00 2026-06-14T00:58:40+00:00

I have data in a .csv file showing enquiries received by different teams on

  • 0

I have data in a .csv file showing enquiries received by different teams on different dates. Enquiries are entered as follows:

Team,Date_received,Date_answered
Team 1,31/01/10,05/02/10
Team 3,05/03/10,17/04/10
...

I want to plot a graph showing how many enquiries each team received over each of the last six months but I’m new to R and getting nowhere fast. I’ve looked up time series documentation (in O’Reilly’s R in a Nutshell) but it seems to be much more complex than what I need.

So far I’ve read in the data and converted the date strings into POSIXlt as follows:

c_data <- read.table("~/data.csv", header=T, sep=",")
c_data$Date_received <- as.Date(c_data$Date_received, "%d/%m/%y")
c_data <- as.POSIXlt(c_data$Date_received)
...

but from there I’m lost. What I want to do is extract the month from the POSIXlt field, count the incidence of each ‘Team’ string in each month and plot them against each other, but I don’t know which functions handle those things and I’m struggling with the docs.

I know I’m at early stages here so even just a pointer to the function I should be reading about would be appreciated.

  • 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-14T00:58:41+00:00Added an answer on June 14, 2026 at 12:58 am

    Starting with some dummy data:

    c_data <- data.frame(Team=paste("team", sample(1:3,10, replace=TRUE)), 
                        Date_received=paste(sample(1:31,10,replace=TRUE), sample(1:12,10,replace=TRUE), rep(10,10,replace=TRUE), sep="/"))
    c_data
        Team Date_received
    1  team 3       13/7/10
    2  team 1        2/5/10
    3  team 2       14/5/10
    4  team 1       15/4/10
    5  team 1       25/1/10
    6  team 3       30/4/10
    7  team 3       23/9/10
    8  team 3        7/9/10
    9  team 2        7/6/10
    10 team 2        4/6/10
    

    First you have to declare your dates as Date objects.

    c_data$Date_received <- as.Date(c_data$Date_received, "%d/%m/%y")
    

    To extract the month, nothing simpler:

    c_data$month <- format(c_data$Date_received, "%m")
    c_data$month
    [1] "07" "05" "05" "04" "01" "04" "09" "09" "06" "06"
    

    And then, to find the incidence of each team per month, you just have to tabulate according to your teams and months:

    t_data <- table(c_data$Team, c_data$month)
    t_data
    
             01 04 05 06 07 09
      team 1  1  1  1  0  0  0
      team 2  0  0  1  2  0  0
      team 3  0  1  0  0  1  2
    

    And now as a data.frame (for plotting purposes):

    d_data <- as.data.frame(t_data)
    d_data
         Var1 Var2 Freq
    1  team 1   01    1
    2  team 2   01    0
    3  team 3   01    0
    4  team 1   04    1
    5  team 2   04    0
    6  team 3   04    1
    7  team 1   05    1
    8  team 2   05    1
    9  team 3   05    0
    10 team 1   06    0
    11 team 2   06    2
    12 team 3   06    0
    13 team 1   07    0
    14 team 2   07    0
    15 team 3   07    1
    16 team 1   09    0
    17 team 2   09    0
    18 team 3   09    2
    
    # Back to Date objects
    d_data$Var2 <- as.Date(paste("1",d_data$Var2,"10",sep="/"), "%d/%m/%y") 
    
    library(ggplot2)
    ggplot(d_data, aes(Var2, Freq, group = Var1, color = Var1)) +
    geom_line()
    

    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 problem in splitting data. I have data as follows in CSV file:
I have to write huge data in text[csv] file. I used BufferedWriter to write
I have some questions about importing data from Excel/CSV File into SQL Server. Let
I have a number of images and a CSV data file that I want
I have a System.Data.DataTable which is populated by reading a CSV file which sets
I have made a java application that stores data from a .csv file to
I have a query that returns a lot of data into a CSV file.
I have a csv file with data looking like (see below). I need help
I have a .csv file that contains data for only certain columns in a
I have a .csv file containing 3 columns of data. I need to create

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.