x=["245.2","256.3"]
y=["205.7","205.1"]
z=["202.4","250.5"]
'''output <-- function(x=NULL, y=NULL , z= NULL)
{
if(is.vector(x) & is.vector(y) & is.vector(z)){
data %>%
select(x,y,z) %>% #selecting the desired columns
filter_at(.vars= x, any_var(.==1)) %>%
filter_at(.vars= y, any_var(.==1)) %>%
filter_at(.vars= z, any_var(.==1)) %>%
summarise(Total= n())
} else if(is.vector(x) &is.vector(y)){
data%>%
select(x,y)
filter_at(.vars = x, any_vars(.==1))%>%
filter_at(.vars = y, any_vars(.==1)) %>%
summarise(Total= n())
} else if(is.vector(x)){
data%>%
select(x)
filter_at(.vars = x, any_vars(.==1))%>%
summarise(Total= n())
} else
print("enter a valid vector of code")
}
'''
here i have to put a function of filter and is to check that data is vector than function is pass. thanks in advance
Aucun commentaire:
Enregistrer un commentaire