if else statement dateframe

65 views Asked by At

I have a dataframe (df):

df<- Column1  Column2 Column3

I want to do an ifelse statement with the mean of the values of Column2 and call including two other dataframes (df2 and df3) in my statement.

Here is the formula I used:

ifelse(mean(df$Column2)<5,df2,df3)

It does not produce df2 or df3 as a dataframe.

What am I doing wrong?

1

There are 1 answers

0
C8H10N4O2 On

From the "stupid but works" department:

get(ifelse(mean(df$Column2)<5,"df2","df3"))