Home > Back-end >  how to create a How to Create a Frequency Polygon in R that takes 3 columns from the data frame into
how to create a How to Create a Frequency Polygon in R that takes 3 columns from the data frame into

Time:03-26

Today I want to learn a little bit about the R statistical programming language.

I'm not finding the tutorials or anything that i have looked up online to be helpful. I want to create a frequency polygon that shows the date on the X axis , the Count on the y axis and each line representing each vehicle. to summarize, I want-

          X axis=  date 
          Y axis=  count
          line=    vehicle type

bellow is an image of the data frame I am working with

enter image description here

The lines look weird, because the dataset is very small.

CodePudding user response:

Using the reproducible dataset from Quinten and grouping by timestamp:

library(dplyr)
library(ggplot2)

count_df <- df %>% group_by(TIME1) %>% dplyr::summarize(n = sum(Count1))

ggplot(count_df, aes(x = TIME1, y = n))  
geom_line()  
ylab("count")  
xlab("time")

enter image description here

  • Related