我最近不得不在笔记本电脑中安装新的硬盘驱动器,因此也要重新安装所有R软件包。我安装了R版本3.5.1,并运行了代码以安装以前安装的所有软件包。但是,当我加载它们时,尤其是常用的“ ape”包,出现以下错误:
public class Event
{
public string EventType { get; set; }
public DateTime? EventDateTime { get; set; }
public override string ToString()
{
return $"{EventDateTime}: {EventType}";
}
}
public class Program
{
static void Main(string[] args)
{
// Events for the day ordered by EventDateTime
var events = new List<Event>
{
new Event {EventType = "JE",
EventDateTime = DateTime.Parse("10/21/2018 12:23 PM")},
new Event {EventType = "JE",
EventDateTime = DateTime.Parse("10/21/2018 2:29 PM")},
new Event {EventType = "JE",
EventDateTime = DateTime.Parse("10/21/2018 2:40 PM")},
new Event {EventType = "JS",
EventDateTime = DateTime.Parse("10/21/2018 2:15 PM")},
new Event {EventType = "JS",
EventDateTime = DateTime.Parse("10/21/2018 3:12 AM")},
new Event {EventType = "JS",
EventDateTime = DateTime.Parse("10/21/2018 12:12 PM")},
}.OrderBy(e => e.EventDateTime);
// Initialize lastEventType to the opposite of the type of event we
// expect to see first (which is "JS" unless there are no "JS" events)
var lastEventType = events.Any(e => e.EventType == "JS")
? "JE" : "JS";
foreach (var e in events)
{
var errorMessage = string.Empty;
// Check for error
if (e.EventType == lastEventType)
{
Console.ForegroundColor = ConsoleColor.Red;
// Create an error message
var error = e.EventType == "JS"
? "JS before JE"
: "JE before JS";
var dateStr = e.EventDateTime?.ToShortDateString() ?? "[null date]";
errorMessage = $" - On {dateStr} this error occurred: [{error}]";
// Your code would include:
// errorList.Add(errorMessage);
// errorListRow.Add(dc);
}
Console.WriteLine(e + errorMessage);
Console.ResetColor();
// Update the lastEventType with this event type
lastEventType = e.EventType;
}
GetKeyFromUser("\nDone! Press any key to exit...");
}
}
我无法在线上找到针对此特定问题的解决方案,有什么想法吗?
谢谢
答案 0 :(得分:1)
未安装的ape
软件包可能存在依赖性。要解决此问题,请使用以下命令重新安装软件包:install.packages("ape", dependencies = T)
,它将自动安装ape
所依赖的任何其他软件包。