如何创建循环以在df中添加新列-R

时间:2019-07-10 16:12:43

标签: r

我需要您的帮助。我有一个包含日期和值的数据框,如下所示:

Id        Date1      Date2        Value
1       01/01/18    01/03/18     1.000
2       01/05/18    01/07/18     500
3       01/03/18    01/06/18     17.000
4       01/12/18    01/01/19     670
5       01/10/18    01/12/18     9.600

我需要创建一个for循环,以便将新列添加到i =(0,60,90,180,270,360)的数据框中,因此  ->如果RifDate(是固定日期)-Date1> i和RifDate-Date2

因此,我希望获得六个包含0或行中的值的新列

1 个答案:

答案 0 :(得分:0)

根据您的“ RifDate”,您可能会得到不同的结果:

let myInt = 5  
print("My int is \(/*no auto complete here*/)  

print("My int is \()")  // then I can go back into \() and autocomplete works  
相关问题