我被要求对R-updates的日期和昵称进行子集。我还被要求排除带有"NA"一词的条款,并将日期转换为工作日。虽然我已经设法排除了NAs,但我不知道如何在同时子集的情况下将日期转换为工作日。
subset(Rversions, select = nickname:date, !is.na(Rversions$nickname))
wday(dates, label = TRUE)
输出:
nickname date
79 Great Pumpkin 2011-10-31
80 December Snowflakes 2011-12-22
81 Gift-Getting Season 2012-02-29
82 Easter Beagle 2012-03-30
83 Roasted Marshmallows 2012-06-22
我不认为subset
函数将允许您添加/转换数据。可以使用transform
功能
result <- transform(subset(Rversions, select = cnickname:date, !is.na(nickname)),
date = weekdays(date))
result