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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:38:40+00:00 2026-05-27T19:38:40+00:00

I have CSV data of a log for 24 hours that looks like this:

  • 0

I have CSV data of a log for 24 hours that looks like this:

svr01,07:17:14,'u1@user.de','8.3.1.35'
svr03,07:17:21,'u2@sr.de','82.15.1.35'
svr02,07:17:30,'u3@fr.de','2.15.1.35'
svr04,07:17:40,'u2@for.de','2.1.1.35'

I read the data with tbl <- read.csv("logs.csv")

How can I plot this data in a histogram to see the number of hits per hour?
Ideally, I would get 4 bars representing hits per hour per srv01, srv02, srv03, srv04.

Thank you for helping me here!

  • 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-05-27T19:38:40+00:00Added an answer on May 27, 2026 at 7:38 pm

    An example dataset:

    dat = data.frame(server = paste("svr", round(runif(1000, 1, 10)), sep = ""),
                     time = Sys.time() + sort(round(runif(1000, 1, 36000))))
    

    The trick I use is to create a new variable which only specifies in which hour the hit was recorded:

    dat$hr = strftime(dat$time, "%H")
    

    Now we can use some plyr magick:

    hits_hour = count(dat, vars = c("server","hr"))
    

    And create the plot:

    ggplot(data = hits_hour) + geom_bar(aes(x = hr, y = freq, fill = server), stat="identity", position = "dodge")
    

    Which looks like:

    enter image description here

    I don’t really like this plot, I’d be more in favor of:

    ggplot(data = hits_hour) + geom_line(aes(x = as.numeric(hr), y = freq)) + facet_wrap(~ server, nrow = 1)
    

    Which looks like:

    enter image description here

    Putting all the facets in one row allows easy comparison of the number of hits between the servers. This will look even better when using real data instead of my random data.

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

Sidebar

Related Questions

I have a CSV file that looks like this, where time is a UNIX
I have a ever growing csv file that looks like: 143100, 2012-05-21 09:52:54.165852 125820,
I have a CSV file containing log on data for users and would like
I have the following code for doing a linear regression: data<-read.csv(File.csv,header=T) trans<-log(data) attach(trans) outdata<-summary(lm(Y~A
I have a csv file with data looking like (see below). I need help
I have a number of images and a CSV data file that I want
I have a .csv file that contains data for only certain columns in a
I have a data structure created using read.csv() of dimensions 130, 395. I am
I have some CSV data files that I want to import into mySQL. I
I have following CSV data: 10,11,12.34 I can parse this using CSV from the

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.