<div dir="ltr"><div>Michelle,</div><div><br></div><div>Aproveitando seu código inicial, pensei em algo assim...</div><div><br></div><div><div><font face="monospace, monospace">### <code r></font></div><div><font face="monospace, monospace">urls1 <- c("<a href="https://www.dropbox.com/s/kgxo3s8qrrv74p3/AAparaCalculodaMedia.txt">https://www.dropbox.com/s/kgxo3s8qrrv74p3/AAparaCalculodaMedia.txt</a>",</font></div><div><font face="monospace, monospace"> "<a href="https://www.dropbox.com/s/fhutciprhgt077x/AIGparaCalculodaMedia.txt">https://www.dropbox.com/s/fhutciprhgt077x/AIGparaCalculodaMedia.txt</a>",</font></div><div><font face="monospace, monospace"> "<a href="https://www.dropbox.com/s/kvubgji1tce8sm8/AXPparaCalculodaMedia.txt">https://www.dropbox.com/s/kvubgji1tce8sm8/AXPparaCalculodaMedia.txt</a>")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">urls2 <- sub("^.*/s/", "<a href="http://dl.dropbox.com/s/">http://dl.dropbox.com/s/</a>", urls1)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">AA <- read.table(urls2[1], header=T, <a href="http://as.is">as.is</a>=T)</font></div><div><font face="monospace, monospace">AIG <- read.table(urls2[2], header=T, <a href="http://as.is">as.is</a>=T)</font></div><div><font face="monospace, monospace">AXP <- read.table(urls2[3], header=T, <a href="http://as.is">as.is</a>=T)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Symbols <- c("AA", "AIG", "AXP")</font></div><div><font face="monospace, monospace">sapply(Symbols, function(x) length(get(x)))</font></div><div><font face="monospace, monospace">sapply(Symbols, function(x) nrow(get(x)))</font></div><div><font face="monospace, monospace">sapply(Symbols, function(x) tail(names(get(x)),1))</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">### Correlações entre leituras diferentes da mesma empresa</font></div><div><font face="monospace, monospace">cor(AA[2:394], use="pairwise.complete.obs")</font></div><div><font face="monospace, monospace">cor(AIG[2:394], use="pairwise.complete.obs")</font></div><div><font face="monospace, monospace">cor(AXP[2:394], use="pairwise.complete.obs")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">### Correlações entre mesma leitura das diferentes empresas</font></div><div><font face="monospace, monospace">### Testando com 4 matrizes</font></div><div><font face="monospace, monospace">Symbols <- c("AA", "AIG", "AXP", "AXP")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">COR <- NULL</font></div><div><font face="monospace, monospace">for (i in 2:394) {</font></div><div><font face="monospace, monospace"> DAT <- NULL</font></div><div><font face="monospace, monospace"> for (a in Symbols) {</font></div><div><font face="monospace, monospace"> col <- get(a)[,i]</font></div><div><font face="monospace, monospace"> DAT <- cbind(DAT, col)</font></div><div><font face="monospace, monospace"> }</font></div><div><font face="monospace, monospace"> lin <- cbind(ID=i, cor(DAT, use="pairwise.complete.obs"))</font></div><div><font face="monospace, monospace"> colnames(lin) <- c("ID", Symbols)</font></div><div><font face="monospace, monospace"> COR <- rbind(COR, lin)</font></div><div><font face="monospace, monospace">}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">### As 4 matrizes originariam uma matriz cor 4x4 para cada leitura</font></div><div><font face="monospace, monospace">### As matrizes cor foram empilhadas em uma saída única (COR), onde </font></div><div><font face="monospace, monospace">### cada 4 linhas são referentes à uma leitura identificada por ID.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">head(COR)</font></div><div><font face="monospace, monospace"># ID AA AIG AXP AXP</font></div><div><font face="monospace, monospace"># col 2 1.00000000 0.64408120 -0.088884203 -0.088884203</font></div><div><font face="monospace, monospace"># col 2 0.64408120 1.00000000 -0.109883913 -0.109883913</font></div><div><font face="monospace, monospace"># col 2 -0.08888420 -0.10988391 1.000000000 1.000000000</font></div><div><font face="monospace, monospace"># col 2 -0.08888420 -0.10988391 1.000000000 1.000000000</font></div><div><font face="monospace, monospace"># col 3 1.00000000 0.01779314 0.003447422 0.003447422</font></div><div><font face="monospace, monospace"># col 3 0.01779314 1.00000000 0.158657131 0.158657131</font></div></div><div><font face="monospace, monospace">### </code></font></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Éder Comunello <<a href="mailto:comunello.eder@gmail.com" target="_blank">c</a><a href="mailto:omunello.eder@gmail.com" target="_blank">omunello.eder@gmail.com</a>> <br>Dourados, MS - [22 16.5'S, 54 49'W]<br></div></div></div>
<br><div class="gmail_quote"><br></div></div></div>