我是R的新手,但是我已经制作了许多具有较小数据集的相关图.但是,当我尝试绘制一个大型数据集(2gb +)时,我可以很好地生成绘图,但图例不会显示.有什么建议?还是替代品?
library(gplots)
r.cor <- cor(r)
layout(matrix(c(1,1,1,1,1,1,1,1,2,2), 5, 2, byrow = TRUE))
par(oma=c(5,7,1,1))
cx <- rev(colorpanel(25,"yellow","black","blue"))
leg <- seq(min(r.cor,na.rm=T),max(r.cor,na.rm=T),length=10)
image(r.cor,main="Correlation plot Normal/Tumor data",axes=F,col=cx)
axis(1, at=seq(0,1,length=ncol(r.cor)), labels=dimnames(r.cor)[[2]],
cex.axis=0.9,las=2)
axis(2,at=seq(0,1,length=ncol(r.cor)), labels=dimnames(r.cor)[[2]],
cex.axis=0.9,las=2)
image(as.matrix(leg),col=cx,axes=T)
Run Code Online (Sandbox Code Playgroud)
错误
plot.new():图边距太大
tmp <- round(leg,2)
axis(1,at=seq(0,1,length=length(leg)), labels=tmp,cex.axis=1)
Run Code Online (Sandbox Code Playgroud) 我是R的新手,所以我真的需要一些帮助.我只想独立地对每列进行排序.任何帮助表示赞赏!
> mat <- matrix(c(45,34,1,3,4325,23,1,2,5,7,3,4,32,734,2),ncol=3)
> mat
[,1] [,2] [,3]
[1,] 45 23 3
[2,] 34 1 4
[3,] 1 2 32
[4,] 3 5 734
[5,] 4325 7 2
Run Code Online (Sandbox Code Playgroud)
至
[,1] [,2] [,3]
[1,] 1 1 2
[2,] 3 2 3
[3,] 34 5 4
[4,] 45 7 32
[5,] 4325 23 734
Run Code Online (Sandbox Code Playgroud) 我有以下矩阵
2 4 1
6 32 1
4 2 1
5 3 2
4 2 2
Run Code Online (Sandbox Code Playgroud)
我想基于第3列制作以下两个矩阵
第一
2 4
6 32
4 2
Run Code Online (Sandbox Code Playgroud)
第二
5 3
4 2
Run Code Online (Sandbox Code Playgroud)
我能想出最好的,但是我收到了错误
x < - cbind(mat [,1],mat [,2])如果mat [,3] = 1
y < - cbind(mat [,1],mat [,2])如果mat [,3] = 2
我是Perl的新手,我遇到了精神上的障碍.我需要从制表符分隔文件中提取信息,如下所示.
#name years risk total
adam 5 100 200
adam 5 50 100
adam 10 20 300
bill 20 5 100
bill 30 10 800
Run Code Online (Sandbox Code Playgroud)
在此示例中,制表符分隔文件显示投资的长度,风险金额以及投资结束时的总金额.
我想解析这个文件,并为每个名称(例如adam)计算投入的年数5 + 5,并计算收入总和(200-100)+(100-50)+(300-20).我还想保存每个名字的总数(200,100,300).
这是我到目前为止所尝试的:
my $filename;
my $seq_fh;
open $seq_fh, $frhitoutput
or die "failed to read input file: $!";
while (my $line = <$seq_fh>) {
chomp $line;
## skip comments and blank lines and optional repeat of title line
next if $line =~ /^\#/ || $line =~ /^\s*$/ …Run Code Online (Sandbox Code Playgroud) 尝试计算列之间的相关性,但cor()函数仅允许一次比较两列.
> mat <- matrix(c(45,34,1,3,4325,23,1,2,5,7,3,4,32,734,2,53),ncol=4)
> mat
[,1] [,2] [,3] [,4]
[1,] 45 4325 5 32
[2,] 34 23 7 734
[3,] 1 1 3 2
[4,] 3 2 4 53
Run Code Online (Sandbox Code Playgroud)