I have 4 separate files about calories separately by daily, hourly, minutesnarrow and minutes wide.
I got the summary done for each of this table.
Now I want to compare the calories by time by merging or summarise all the four tables, how do I do that?
I have defined/distinct the columns in each table.
.
I want to understand to make the code chunk for this. I am newcomer
Hi!
To help us help you, could you please prepare a repr oducible ex ample (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
hourly_calories %>%
select(ActivityHour, Calories) %>%
drop_na() %>%
summary()
daily_calories %>%
select(ActivityDay, Calories) %>%
drop_na() %>%
summary()
minutes_caloriesNarrow %>%
select(ActivityMinute, Calories) %>%
drop_na() %>%
summary()
minutes_caloriesWide %>%
select(ActivityHour, Calories00, Calories01, Calories02, Calories03, Calories04, Calories05, Calories06) %>%
drop_na() %>%
summary()
I have downloaded reprex as told by you. the above code chunk has been run down. I want to define the data by calories by daily, hourly and by minutes
That is not what I meant, I'm asking you for a reproducible example (not just to download the reprex
package) and we can't reproduce your problem without sample data.
Please read the guide on the link I gave you before and try to provide a proper reproducible example.
the reply you sent meant to put. "datapasta::df_paste" this with the data I am working right?
But what if the data I want to share is quite large.
or do I need to copy the data after run down of the code chunk and paste it here?
If practical, yes, but you can also use any made-up data that can illustrate your problem.
Use a subset of it, just large enough to illustrate your issue.
Sorry, I don't understand what you mean with this
lets play around with a 'simpler' version of what you want to do;
to simplify the discussion, lets imagine that you have daily and weekly data; which is 7 into 1 (a smaller number and easier to write out examples of than 60 min into 24 hours days...)
set.seed(42)
(xmpl_df <- expand_grid(day=1:7,week=1:2) |>
mutate(some_measured_value=rnorm(14)))
(day_smry <- xmpl_df |>
group_by(day) |>
summarise(across(some_measured_value,
list(mean=mean))))
(week_smry <- xmpl_df |>
group_by(week) |>
summarise(across(some_measured_value,
list(mean=mean))))
How do you think you want to present these two tables which are analogous to your three?
stack them vertically ? stack them horizontally with some sort of alignment ?
hey so basically it is the bellabeat project capstone files. what I have done is summarise
daily_calories
hourly_calories
minutes_caloriesNarrow
minutes_caloriesWide
all of these 4 separate read_csv file have columns defined, distinct and summarise. colnames I can share here
or for instance I want to do summarise the column hourly, by minutes and daily. how should I go by.
I wish someone was there with me in person. I am home bound and no one knows R in my circle of friend
now I wanted these four tables to be merged into one to define calories variation from minutes to hourly to daily
system
Closed
February 6, 2023, 4:59pm
9
This topic was automatically closed 21 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.