mercredi 15 novembre 2017

Switch code R with different if statements

So I'm trying to wrap my head around the switch function because I think it is the one I need. Essentially I have a dataset that needs to be sorted based on different criteria.

So if Case 1 = 1

I have a set of code and if statements that would do something with the data set

Then if Case 1 = 0,

then there are a set of different combinations the user can choose (1 use this data, 0 don't use):

Use_A = 0/1 
Use_B = 0/1
Use_C = 0/1
Use_D = 0/1

and then based on which USES the are selected, there's a set of if statements that would happen.

I believe the switch function is what would be used, but I'm not 100% sure how to do about this. The end result of any case will be a new data frame

Aucun commentaire:

Enregistrer un commentaire