Re: [R] write data from function into external table

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Wed 14 Jun 2006 - 20:59:39 EST

maybe you're looking for something like,

test <- 1:3
testfct <- function(x){

    x[1] <- 100
    x
}
############
test
testfct(1)
testfct(test)

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


Dear list,
My apologies if a solution / explanation to this already exists on the list,
but it is difficult to assign it to a certain keyword.

test<-c(1:3)
testfct <- function(x) {test[1]<-100}
 test
[1] 1 2 3

 testfct(1)
[1] 1 2 3

Basically, I would like to write data into an external table that the function
does not know. Why is this not working / what alternatives exist?

Thanks, Sebastian



Sebastian Leuzinger

University of Basel, Department of Environmental Science Institute of Botany
Schönbeinstr. 6 CH-4056 Basel
ph 0041 (0) 61 2673511
fax 0041 (0) 61 2673504
email Sebastian.Leuzinger@unibas.ch
web http://pages.unibas.ch/botschoen/leuzinger

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 14 20:58:18 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 14 Jun 2006 - 22:11:58 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.