# Number of users connected to the Internet through a server every minute
ts <- datasets::WWWusage
# Calculate FWHM
ts_FWHM <- FWHM(ts)
# Half maximum (for the plots)
hm <- min(ts) + (max(ts) - min(ts)) / 2
hm_plot <- ts
hm_plot[which(hm_plot > hm)] <- hm
hm_plot[which(hm_plot < hm)] <- NA
# Plots
plot(ts, ty = "l", xlab = "Time", ylab = "Number of users")
lines(hm_plot, lwd = 3, col = 2)
Run the code above in your browser using DataLab