Raquel Rangel de Meireles GuimarĂ£es
2011-Jan-27 18:33 UTC
[R] Saving log file in R and display run time
Hi all, I have two basic questions, hope you should help me: 1. How do I save a log file in R with the results? For example, in Stata it can be done by using "log using c:\...\test.txt" 2. How do I display the execution time of one function like the one below: CalculaCorrelacao <- function(construto, n) { library(polycor) for (i in 2:n){ for (j in i:n+1){ x1 <- construto[[i]] x2 <- construto[[j]] temp1 <- polychor(x1, x2, ML = FALSE,maxcor=.9999) corr[i-1,j-1] <- temp1 corr[j-1,i-1] <- temp1 } } return(corr) } Best regards, Raquel -- Raquel Rangel de Meireles Guimar?es Doutoranda em Demografia raquel at cedeplar.ufmg.br http://ufmg.academia.edu/RaquelGuimaraes Cedeplar - Centro de Desenvolvimento e Planejamento Regional Faculdade de Ci?ncias Econ?micas, UFMG (http://www.cedeplar.ufmg.br)
On 27.01.2011 19:33, Raquel Rangel de Meireles Guimar?es wrote:> Hi all, > > I have two basic questions, hope you should help me: > > 1. How do I save a log file in R with the results? For example, in Stata > it can be done by using "log using c:\...\test.txt"See ?sink.> 2. How do I display the execution time of one function like the one below: > > CalculaCorrelacao <- function(construto, n) { > library(polycor) > for (i in 2:n){ > for (j in i:n+1){ > x1 <- construto[[i]] > x2 <- construto[[j]] > temp1 <- polychor(x1, x2, ML = FALSE,maxcor=.9999) > corr[i-1,j-1] <- temp1 > corr[j-1,i-1] <- temp1 > } > } > return(corr) > }See ?system.time. Uwe Ligges> Best regards, > > Raquel >