Home > database >  Making a line graph with certain X Y values expressed differently with lines of 33 user IDs in R
Making a line graph with certain X Y values expressed differently with lines of 33 user IDs in R

Time:02-06

I'm trying to put ActivityDate on the X Axis, and Calories on the Y Axis, relating to how 33 different users ranged in their calorie burnings daily. I'm new to ggplot and visualizations as you can tell, so I'd appreciate the most basic solution that I can understand. Thank you so much.

I really tried several iterations of this code, and each one of them weren't quite right in how the visualization turned out. Here are a couple of my thoughts:

##first and foremost: install.packages("tidyverse") install.packages("here") library(tidyverse) library(here)

Attempt 1 Bar Graph

ggplot(data=trimmed_dactivity) geom_bar(mapping=aes(x=Id, color=ActivityDate))

Example data:


set.seed(13)

fakedata <- expand.grid(
  Id = 1:33,
  ActivityDate = seq(as.Date("2016-04-13"), length.out = 10, by = "day")
)

fakedata$Calories <- round(rnorm(330, 2500, 500))
  • Related