Create a new table with quantitative variables > or =

Hello

I'm working with a table of data's about fifa with the variables "Name" "Wage" "Nationality" 34 . I'd like to create a new table with the variable "Wage >= 12" and an other one with Wage=<12. (12 is the average wage) . How can I generate those new table without changing my excel , so thanks to R studio ?
Thank you very much for your help.

Benjamin

Hi,

what did you try so far ?

Using dplyr is should be straightforward to filter your table. I would advice to read this book. You'll find answer on how to do such task
https://r4ds.had.co.nz/

Hi,

Thank you very much for your answer. Firstly, I have tried to generate a new variable with wage>=12 and then put this variable in a new table but it didn't work. I will read your documentation, thanks for this !

What I have done it's :

dataf %>%
filter((Wage) >= 12)

But I can't create a new variable with those data and put this variable in the table

if you want a new table, just assign the result to a new variable

new_data <- dataf %>%
     filter(Wage >= 12)

Might benj1 be looking for a new table with a new column?

new_data <- dataf %>% mutate(HighWage = Wage >= 12)

Yes Possible.
@benj1 it would help to have more details about what you tried and what you seek ?

Thanks for your help, I have succeeded to do what I wanted ! :slight_smile:

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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