Hi all,
I have created the following tibble working with Bellabeat dataset:
select(-TrackerDistance,-VeryActiveDistance,-ModeratelyActiveDistance,-LightActiveDistance ,-VeryActiveMinutes,
I want to create a point graph adding a trend line using the following function:
geom_smooth(mapping=aes(x=ActiveMinutes, y=Calories))+
geom_point(mapping=aes(x=ActiveMinutes, y=Calories))
Unfortunately the following error message is shown:
geom_smooth() using method = 'loess' and formula 'y ~ x'
Any idea what I am doing wrong?
Many thanks in advance

Make sure that ActiveMinutes and Calories are the correct column names in your daily_activity_summary_all dataset.

For better help try to load a reproducible example of data.

Other way is :

# paste the result of dput()
dput(daily_activity_summary_all[30 ,  ]) # for first 30 rows and all columns.
1 Like

This is information about the smoothing method used, not an error message. From the documentation for geom_smooth():

Smoothing method (function) to use, accepts either NULL or a character vector, e.g. "lm", "glm", "gam", "loess" or a function, e.g. MASS::rlm or mgcv::gam, stats::lm, or stats::loess. For method = NULL the smoothing method is chosen based on the size of the largest group (across all panels). stats::loess() is used for less than 1,000 observations; otherwise mgcv::gam() is used with formula = y ~ s(x, bs = "cs") with method = "REML".

Also, I would not get rid of variables just before calculating the totals of those variables.

daily_activity_summary_all <- daily_activity %>% 
  mutate(ActiveDistance = VeryActiveDistance + ModeratelyActiveDistance + LightActiveDistance,
         ActiveMinutes = VeryActiveMinutes + FairlyActiveMinutes + LightlyActiveMinutes
         ) %>%
  select(-c(TrackerDistance, VeryActiveDistance, ModeratelyActiveDistance, LightActiveDistance,
         VeryActiveMinutes, FairlyActiveMinutes, LightlyActiveMinutes, LoggedActivitiesDistance
         ) %>%
1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.