我想知道如何从R中的表中获取特定行.例如,
> a <- c(13,13,
14,14,14,14,14,14,
15,15,15,15,15,15,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
17,17,17,17,17,17,17,
18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
19,19,19,19,19,19,19,19,19,19,19,
20,20,20,20,20,20,20,20,20,
21,21,21,21,21,21,21,21,21,21,21,
22,22,22,22,22,22,22,22,22,
23,23,23,24,25,25,27)
> table(a)
a
13 14 15 16 17 18 19 20 21 22 23 24 25 27
2 6 6 15 7 17 11 9 11 9 3 1 2 1
Run Code Online (Sandbox Code Playgroud)
如何提取表格的最后一行?
我已经创建了一个矩阵列表,现在我想在所有矩阵中得到行的最大值,我该如何得到它们?
这是列表的代码:
i <- 1
tryList <- list()
treeList <- list()
accList <- list()
for(t_mtry in 1:40){
for(t_ntree in 20:300{
rf <- randomForest(class ~., data=training, mtry=t_mtry, ntree=t_ntree)
tbl <- table(predicted = predict(rf,evalSet,type="class"),actual=evalSet$class)
#get the accuracy of the classification as a list
retVal <- accuracy(tbl)
tryList <- c(tryList,t_mtry)
treeList <- c(treeList,t_ntree)
accList <- c(accList,mean(retVal))
}
matrixList[[i]] <- matrix(c(tryList,treeList,accList),length(accList)
i <- i + 1
tryList <- list()
treeList <- list()
accList <- list()
}
Run Code Online (Sandbox Code Playgroud)
现在我想要从每个矩阵的accList的最大值.如果我有一个矩阵我使用:
lapply(matrix,max)
max(unlist(matrix[,3]))
Run Code Online (Sandbox Code Playgroud)
但是如何将它与列表一起使用?
我正在尝试为我们的新项目设置我们的Hundson Server for CI.一切运行正常,构建项目,单元测试和FxCop检查运行.但是当我尝试使用StyleCop检查代码时会发生错误.第一:我们使用MS VS 2010在C#中开发,在Hudson Server上安装了.Net 4.0和Windows SDK 7.1.
现在我已将StyleCop.Targets添加到我的SVN并将.cproj文件链接到该文件.如果我在VS2010中构建,除了StyleCop警告之外,每个都很好,但如果Hundson Server尝试构建项目,则会发生以下错误:
error MSB4062: The "StyleCopTask" task could not be loaded from the assembly
C:\Program Files (x86)\MSBuild\..\StyleCop 4.7\StyleCop.dll. Could not load file or
assembly 'Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot
find the file specified. Confirm that the <UsingTask> declaration is correct,
that the assembly and all its dependencies are available, and that the task
contains a public class that implements Microsoft.Build.Framework.ITask.
Run Code Online (Sandbox Code Playgroud)
StyleCop.dll位于Hundson Server的路径中,有人可以告诉我我做错了什么吗?
我正在使用C#开发项目。现在,我已经设置了Hudson服务器,并且在服务器上安装了.Net 4 Framework和Windows SDK 7.1。
该项目成功构建,但是当我使用以下命令启动FxCop时:
"C:\Program Files (x86)\Microsoft FxCop 1.35\fxcopcmd.exe" /file:CommonServiceTool\bin\Release /out:fxcop-result.xml
Run Code Online (Sandbox Code Playgroud)
它加载所有.dll规则文件,然后发生以下异常:
Using system files at: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319.
Could not resolve reference to PresentationFramework.
Could not resolve reference to PresentationCore.
Could not resolve reference to WindowsBase.
12 exceptions occurred while loading Project1.
00) Could not resolve type reference: [PresentationFramework]System.Windows.StartupEventArgs.
01) Could not resolve type reference: [PresentationFramework]System.Windows.Window.
02) Could not resolve type reference: [PresentationFramework]System.Windows.Controls.HeaderedContentControl.
03) Could not resolve type reference: [PresentationCore]System.Windows.Input.ICommand.
04) Could not resolve member reference: System.Windows.ThemeInfoAttribute::.ctor.
... and …Run Code Online (Sandbox Code Playgroud)