How to put data in the tidy format?

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)

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.

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

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.