小编llr*_*lrs的帖子

从angularjs中的下拉列表中调用href

我使用angularjs有下面的下拉菜单.

   <select ng-href="#/edit/{{name.id}}" class="form-control"  id="{{name.id}}">  
   <option ng-repeat="name in addas | filter:cc"
   id="{{name.id}}" value="{{name.name}}">{{name.as_number}}</option>
  </select>
Run Code Online (Sandbox Code Playgroud)

我试图在下拉列表中调用选定选项的href.下拉填充很好.当我选择任何选项时,它不会做任何事情或调用网址.请告诉我如何在angularjs中实现这一目标.

angularjs angularjs-directive

5
推荐指数
1
解决办法
4866
查看次数

GGally putPlot 无法在循环中工作

我正在尝试使用 putplot 来更改 ggpairs 图对角线上的图。我可以一一执行此操作,但是当我使用循环时,对角线元素是相同的!

library(ggplot2)
library(GGally)

p=ggpairs(iris, 
    columns=, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"),
    colour='Species',
    lower=list(continuous='points'), 
    axisLabels='none',  
    upper=list(continuous='blank')
)

for (i in 1:4) {
    p <- putPlot(p, ggplot(iris, aes(x=iris[,i], colour=Species)) + stat_ecdf(), i,i)
}
print(p)
Run Code Online (Sandbox Code Playgroud)

非工作示例

展开循环有效...为什么...?

p <- putPlot(p, ggplot(iris, aes(x=iris[,1], colour=Species)) + stat_ecdf(), 1,1)
p <- putPlot(p, ggplot(iris, aes(x=iris[,2], colour=Species)) + stat_ecdf(), 2,2)
p <- putPlot(p, ggplot(iris, aes(x=iris[,3], colour=Species)) + stat_ecdf(), 3,3)
p <- putPlot(p, ggplot(iris, aes(x=iris[,4], colour=Species)) + stat_ecdf(), 4,4)
Run Code Online (Sandbox Code Playgroud)

工作示例

plot r ggplot2

5
推荐指数
1
解决办法
653
查看次数

在热图中突出显示单元格

我目前正在尝试基于另外两个矩阵设置矩阵的热图并突出显示特定的单元格.

一个例子:

> SOI
         NAP_G021 NAP_G033  NAP_G039 NAP_G120  NAP_G122
2315101  59.69418 27.26002  69.94698 35.22521  38.63995
2315102 104.15294 76.70379 114.72999 97.35930  79.46014
2315104 164.32822 61.83898 140.99388 63.25482 105.48041
2315105  32.15792 21.03730  26.89965 36.25943  40.46321
2315103  74.67434 82.49875 133.89709 93.17211  35.53019

> above150

         NAP_G021 NAP_G033  NAP_G039 NAP_G120  NAP_G122
2315101  0 0 0 0 0
2315102  0 0 0 0 0
2315104  1 0 0 0 0
2315105  0 0 0 0 0
2315103  0 0 0 0 0

> below30

         NAP_G021 NAP_G033 …
Run Code Online (Sandbox Code Playgroud)

r highlight cells heatmap

4
推荐指数
1
解决办法
2579
查看次数

带有colClasses的read.csv出错:scan()期望'真实'得'NULL'

我在使用大型csv文件阅读read.csv.一些网站建议使用colClasses定义每列的类,以使导入过程更快.

t = read.csv("pca.csv",header=TRUE,colClasses = classes)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  : 
scan() expected 'a real', got 'NULL'

classes = c("numeric","integer")
Run Code Online (Sandbox Code Playgroud)

我的一些数据显然有空值.有没有办法使用colClasses,其中"numeric"或"integer"包含空值?此外,有关将大型数据集更快地导入R的任何其他提示将非常有用.我拥有SQL数据库中的所有数据,并且我尝试使用RODBC,这比read.csv()慢得多.

csv import r

4
推荐指数
1
解决办法
7634
查看次数

R For循环执行Fisher测试 - 错误消息

我的数据框看起来像这样:

595.00000    18696      984.00200     32185    Group1  
935.00000    18356      1589.00000    31580    Group2            
40.00010     19251      73.00000      33096    Group3            
1058.00000   18233      1930.00000    31239    Group4                
19.00000     19272      27.00000      33142    Group5            
1225.00000   18066      2149.00000    31020    Group6  
....                 
Run Code Online (Sandbox Code Playgroud)

对于我想做Fisher精确测试的每一组.

table <- matrix(c(595.00000, 984.00200, 18696, 32185), ncol=2, byrow=T)  
Group1 <- Fisher.test(table, alternative="greater")
Run Code Online (Sandbox Code Playgroud)

试图循环数据框:

for (i in 1:nrow(data.frame))  
 {  
 table= matrix(c(data.frame$V1, data.frame$V2, data.frame$V3, data.frame$V4), ncol=2, byrow=T)    
fisher.test(table, alternative="greater")  
}
Run Code Online (Sandbox Code Playgroud)

但得到了错误信息

Error in fisher.test(table, alternative = "greater") :  
FEXACT error 40.  
Out of workspace.  
In addition: Warning message:  
In …
Run Code Online (Sandbox Code Playgroud)

statistics r

4
推荐指数
1
解决办法
7251
查看次数

如何找到对象的创建位置?

我目前正在努力改进对其他脚本有不同调用的代码,我想知道对象的创建位置.对于其中一些只使用文本编辑器的搜索选项工作.通过这个就是想看看obj <-obj =有任何结果.但这不适用于使用该assign功能创建的那些.也没有在加载的脚本中创建的那些.

debug()发生错误时的函数告诉它发生的位置,即使它在另一个脚本中.但是有没有任何函数可以告诉它创建一个对象的代码行?还有其他工具吗?

也许grepl它可以完成,但我不知道创建这样的功能......

r

4
推荐指数
1
解决办法
247
查看次数

`train.error'实际上代表什么是gbm?

考虑下面的简短R脚本.它似乎boost.hitters$train.error与原始残差或训练集的平方误差不匹配.

我根本找不到文档train.error,所以我想知道是否有人知道train.error这里真正代表什么以及它是如何计算的?

library(ISLR)
library(gbm)

set.seed(1)

Hitters=na.omit(Hitters)
Hitters$Salary = log(Hitters$Salary)

boost.hitters=gbm(Salary~.,data=Hitters, n.trees=1000,interaction.depth=4, shrinkage= 0.01)
yhat.boost=predict(boost.hitters,newdata=Hitters,n.trees=1000)

mean(boost.hitters$train.error^2)
mean(boost.hitters$train.error)

mean((yhat.boost-Hitters$Salary)^2)
Run Code Online (Sandbox Code Playgroud)

输出:

[1] 0.03704581
[1] 0.1519719
[1] 0.07148612
Run Code Online (Sandbox Code Playgroud)

r gbm

4
推荐指数
1
解决办法
1593
查看次数

pymongo 中 $and 运算符的正确用法是什么?

我有这样的结构:

>>>test_3.find_one({"humsavar.Disease": {"$exists": True}}, 
{"humsavar":True, "_id":False})

{u'humsavar': [{u'Association': u'Polymorphism',
   u'Disease': u'-',
   u'Gene names': u'DTWD1',
   u'Mutate aa': u'Pro',
   u'Position aa': 9,
   u'Reference aa': u'Leu',
   u'Substitution': u'Leu9Pro',
   u'SwissVarID': u'VAR_036757',
   u'Uniprot': u'Q8N5C7',
   u'dbSNP': u'rs11539522'},
  {u'Association': u'Polymorphism',
   u'Disease': u'Pyruvate dehydrogenase lipoic acid synthetase deficiency',
   u'Gene names': u'DTWD1',
   u'Mutate aa': u'Lys',
   u'Position aa': 13,
   u'Reference aa': u'Glu',
   u'Substitution': u'Glu13Lys',
   u'SwissVarID': u'VAR_036758',
   u'Uniprot': u'Q8N5C7',
   u'dbSNP': u'rs11539519'}]}
Run Code Online (Sandbox Code Playgroud)

我是否应该使用以下查询进行搜索以计算来自 humsavar 的疾病和 dbSNP 的所有文档?

test_3.find({"$and": [{"humsavar.Disease": {"$ne": u'-', "$exists":  True}},
 {"humsavar.dbSNP": {"$ne": u'-', "$ne": None, "$exists":  True}}]},
{"humsavar":True, "_id": …
Run Code Online (Sandbox Code Playgroud)

python mongodb pymongo

4
推荐指数
1
解决办法
6935
查看次数

使用Gstreamer textoverlay插件在视频文件上叠加文本

我正在使用以下命令来做到这一点:

/usr/local/bin/gst-launch-1.0 filesrc location=/home/ubuntu/DELTA.mpg ! textoverlay text="Hello" ! filesink location=/home/ubuntu/delta2.mpg
Run Code Online (Sandbox Code Playgroud)

但是我得到以下输出:

ubuntu@ip-10-185-10-118:~$ /usr/local/bin/gst-launch-1.0 filesrc location=/home/ubuntu/DELTA.mpg  ! textoverlay text="Hello" ! filesink location=file4.mpg
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstTextOverlay:textoverlay0: Could
not multiplex stream.
Additional debug info:
gstbasetextoverlay.c(1892): gst_base_text_overlay_video_event(): /GstPipeline:pipeline0/GstTextOverlay:textoverlay0:
received non-TIME newsegment event on video input
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.024475840
Setting pipeline to PAUSED ...
Setting pipeline to …
Run Code Online (Sandbox Code Playgroud)

bash gstreamer

3
推荐指数
1
解决办法
5112
查看次数

使用iostream处理错误

我正在[Bjarne_Stroustrup]Programming-Principles-and-Practice-Using-C++从2008年开始编写本书,第5章称为Errors使用std_lib_facilities.h和函数调用error.

这是一个例子:

if(x<=0) error("non-positive x");
if(y<=0) error("non-positive y");
int area1=area(x,y);
Run Code Online (Sandbox Code Playgroud)

由于我使用的是没有的Visual Studio 2012std_lib_facilities.h,因此此错误处理程序无法正常工作!什么是iostream错误处理功能,我在哪里可以找到并研究它?

c++ iostream

3
推荐指数
2
解决办法
2570
查看次数