我期望cbind.xts并do.call(cbind.xts)以相似的经过时间执行.R2.11,R2.14也是如此.
对于R2.15.2和xts 0.8-8,do.call(cbind.xts,...)变体执行速度非常慢,这有效地破坏了我以前的代码.
正如Josh Ulrich在下面的评论中指出的那样,xts软件包维护者已经意识到了这个问题.与此同时,有一个方便的工作吗?
可重复的例子:
library(xts)
secs <- function (rows, from = as.character(Sys.time()), cols = 1, by = 1)
{
deltas <- seq(from = 0, by = by, length.out = rows)
nacol <- matrix(data = NA, ncol = cols, nrow = rows)
xts(x = nacol, order.by = strptime(from, format = "%Y-%m-%d %X") +
deltas)
}
n <- 20
d1 <- secs(rows=n*100,cols=n)
d2 <- secs(rows=n*100,cols=n)
system.time(cbind.xts(d1,d2))
Run Code Online (Sandbox Code Playgroud)
与
system.time(do.call(cbind.xts, list(d1,d2)))
Run Code Online (Sandbox Code Playgroud) 我试图构建和编译我的程序时遇到此错误.现在我无法打开程序中的所有.cpp文件.
make [2]:*没有规则来制作目标
Checker.cpp', needed by构建/调试/ GNU-Linux-x86/Checker.o'.停止.
有人可以帮我这个吗?我检查了所有在线资源,但我似乎无法找到解决方案.我迫切需要这个解决.感谢给予的任何帮助.
#include<stdio.h>
void print_hello(void);
int factorial(int n);
Run Code Online (Sandbox Code Playgroud)
#include<stdio.h>
#include<functions.h>
int main()
{
print_hello();
printf("\nThe factorial is: %d \n",factorial(5));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
#include<stdio.h>
#include<functions.h>
void print_hello()
{
printf("\nHello World!\n");
}
Run Code Online (Sandbox Code Playgroud)
#include<stdio.h>
#include<functions.h>
int factorial(int n)
{
if(n!=1)
{
return(n*factorial(n-1));
}
else
return 1;
}
Run Code Online (Sandbox Code Playgroud)
exec : \
compile
echo "Executing the object file"
./compile
compile : main.o hello.o factorial.o
echo "Compiling"
gcc -o compile $^
main.o : main.c functions.h
gcc -c main.c -I./INCLUDE -I./SRC
hello.o : hello.c …Run Code Online (Sandbox Code Playgroud) Rstudio是否有一种机制来配置代码片段,例如Geany?为了更快地编写用户预定义频繁代码的整个部分.它与rstudio中已构建的TAB完成不完全相同.
通过模仿geany片段的示例
虽然片段定义如下所示:
fun = %cursor% <- function(x, ...)\s{\n\n}\n
Run Code Online (Sandbox Code Playgroud)
用法是这样的:
fun<TAB> (like bash style completion)
# will end up in following insertion:
<- function(x, ...) {
}
Run Code Online (Sandbox Code Playgroud)
因此,用户可以使用自己的代码段定义更快地编写代码.并且用户可以定义任何大小的ANY片段以供TAB完成.
它不是Rstudio提取cmd,nieder Rstudio现有的TAB上下文浏览器.
我有以下代码
obj <- list(list(a=4,f=5,g=5),list(a=44,f=54,g=54))
class(obj) <- "mysubclass"
class(obj[1])
class(obj[2])
class(obj[1:2])
class(obj)
Run Code Online (Sandbox Code Playgroud)
导致:
> class(obj[1])
[1] "list"
> class(obj[2])
[1] "list"
> class(obj[1:2])
[1] "list"
> class(obj)
[1] "mysubclass"
Run Code Online (Sandbox Code Playgroud)
通过子集化不会失去课程的适当解决方案是什么?例如,class(obj[1:2])结果mysubclass仍然表现为列表.
以下工作代码读取XML包含大量空元素的文件,然后应用2个更改并以不同的名称再次保存.但它也会改变空元素,比如<element></element>自我关闭的标签,如<element />不需要的.
如何保存它不使用自动关闭标签?或者用另一个词来告诉XML::LibXML如何使用空标签?原始文件是在商业应用程序中生成的,它使用带有空元素的样式,所以我想维持它.
#! /usr/bin/perl
use strict;
use warnings;
use XML::LibXML;
my $filename = 'out.xml';
my $dom = XML::LibXML->load_xml(location => $filename);
my $query = '//scalar[contains(@name, "partitionsNo")]/value';
for my $i ($dom->findnodes($query)) {
$i->removeChildNodes();
$i->appendText('16');
}
open my $out, '>', 'out2.xml';
binmode $out;
$dom->toFH($out);
# now out2.xml has only self-closing tags where previously
# were used empty elements
Run Code Online (Sandbox Code Playgroud)