[R] Connect to internet

2009-12-15 Thread bergarog
Hi
Another way is to set the following environmental variable in windows and  
use standard internet in R.
Variable name: http_proxy
Variable value: ...eg http://web.yourproxy.com:8080
Best regards,
Roger

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to define new operators

2009-12-18 Thread bergarog
Dear R community

I try to create a new operator to build a special sum of two CashFlows. (my  
S4 Class)

I tried the following but this is actually not what I want.

setGeneric("++",function(e1,e2)standardGeneric("++"))

setMethod("+",signature=list("CashFlow","CashFlow"),function(e1,e2){
print("+")
})
setMethod("++",signature=list("CashFlow","CashFlow"),function(e1,e2){
print("++")
})

The problem here is that this work but it treats "++" as a general  
function.. the call is "++"(e1,e2).
I'm looking for somthing like e3 <- e1 ++ e2

Thanks a lot for your help.
Best regards,
Roger

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reading multiple Input Files

2009-12-21 Thread bergarog
Hi

I'm not sure if I understood your problem correctly..
Perhaps you are looking for something like this?

Best regards,
Roger


Result <- c()
yourPath <- "c:\\temp"
filesInDir <- dir(yourPath)
for(file in filesInDir){
fileInfo <- paste(yourPath,file,sep="\\")
tmp <- read.csv(fileInfo)
# assign(file,tmp)
# Result <- c(Result,tmp)
}

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] "diag", "diag<-" and "[" , "[<-"

2010-01-07 Thread bergarog
Dear all
I have the following problem.

M <- matrix(0,3,3) # dimension of M is dinamic and this can lead to the  
next subscript

diag(M[1,1]) <- rep(100,1)
#Error in `diag<-`(`*tmp*`, value = 100) :
# only matrix diagonals can be replaced

diag(M[1,1,drop=F]) <- rep(100,1)
#Error in diag(M[1, 1, drop = F]) <- rep(100, 1) :
# incorrect number of subscripts

diag(M[2:3,1:2]) <- rep(100,2)
# works fine

Is there a way to usw diag as replacement function when the input matrix is  
subscript to a one by one matrix. I don't want extra if(dim==1)... etc.

Thanks a lot in advance.
Best regards,
Roger

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.