Lydie
November 11, 2021, 10:46am
1
Hi all,
I would need to put my dataset into a tidy format.
My colomns are:
Age_Group; Men; Women; Unknown; Total ;Total_Incidence; M_Incidence ;W_Incidence
I used a tidyverse and did
a <- pivot_longer(df, cols = 2:4, names_to ="Gender",
values_to = "Cases")
but I would also need to somehow split the Incidence and connect it with the gender.
Could someone help me?
Thank you!
perhaps
pivot_longer(df,cols=-Age_Group)
Lydie
November 11, 2021, 12:32pm
3
I am not sure...
I tried this, but I still think this is not a tidy format
I will try to help you make a tidy dataset from your data.
Can you please provide a representative example ? I have only screenshots and a list of column names to work with at the moment.
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.…
Lydie
November 11, 2021, 12:57pm
5
Unfortunately, I can not upload an excel file, so again one screenshot of my raw data
Thank you
Hello,
I'm sure you shared this image with the best intentions, but perhaps you didnt realise what it implies.
If someone wished to use example data to test code against, they would type it out from your screenshot...
This is very unlikely to happen, and so it reduces the likelihood you will receive the help you desire.
Therefore please see this guide on how to reprex data. Key to this is use of either datapasta, or dput() to share your data as code
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.…
system
Closed
December 2, 2021, 1:21pm
7
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.