R data.table坦率带有负值

问题描述

我有这个非常简单的可重复数据

function addRowsWithDate() {
  var ss = SpreadsheetApp.getActiveSheet();
  
  var Today = new Date();
  Today.setDate(Today.getDate()+3); // I am using this to experiment with different dates
  var newDate = new Date(Today);
  var dayOfWeek = Today.getDay();
  
  
  if (dayOfWeek<=3 || dayOfWeek==6){ // On Saturday through Wednesday
    newDate.setDate(newDate.getDate()+2);
    ss.insertRowsBefore(1,1); // Add new rows
    ss.getRange(1,1).setValue(newDate); // Set date to the day after tomorrow 
    ss.getRange(1,2).setValue(Today); 
  }
}

library(data.table) x <- c(42,32,22,91,81,71,51) x[frank(x)] # correctly sorted # 22 32 42 51 71 81 91 x[frank(-x)] # INCORRECT # 81 71 51 42 32 22 91 似乎有些我不理解的地方,为什么世界上frank都能在所有元素上起作用,而frank(x)在所有元素上都能很好地起作用,但第一个元素却起作用...我很困惑。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)