Re: [R] Debugging a program written in the R language
Thomas, This is what I use for writing R programs. I use it with Linux but adapting it for Windows shouldn't be that much of a problem for us MIT guys. In ~/.Rprofile (so it gets loaded every time I start R) I have myedit - function(object) { system(if [ ! -d $HOME/stat-misc/Rsrc ]; then mkdir $HOME/stat-misc/Rsrc; fi) system(paste(vim $HOME/stat-misc/Rsrc/,object,.R,sep=)) source(paste(~/stat-misc/Rsrc/,object,.R,sep=)) } To write a program called 'functionName' I do, within R, myedit('functionName'). This opens up an editor, vim in my case, for writing the function and saves the result in the ~/stat-misc/Rsrc directory and in the current R session. I can now repeat myedit('functionName') until I finally get it right. The function is also accessible with myedit() from any other R session at any time. Good luck, Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ 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
Re: [R] help with writing function
On Tue, 13 Dec 2005, Oarabile Molaodi wrote: I'm trying to write a function that takes a vector of length n and then takes the first value of the vector i.e j=1 and forms a new vector of length n (i.e replicate the first value n times). This function will then calculate the absoulte difference of the original vector and the new vector and store the results omitting the difference between the value and itself. This function should be able to repeat the procedure for each of the j's i.e j=2 to n. The results should all be stored together. Below is what I've tried so far but it seems to work only for j=1 . Your help will be highly appreciated. IED-function(risk){ n-length(risk) i-c(1:n) Diff-numeric() for(j in 1:n){ relrisk-risk relrisk[i]-relrisk[j] Difference-abs(risk-relrisk) Difference-Difference[-c(1:j)] Difference-append(Diff,Difference) return(Difference) } } How about IED - function(risk){ n-length(risk) Diff-numeric(n) for(j in 1:n){ relrisk-rep(risk[j],n) Diff[j]-sum(abs(risk-relrisk)[-j]) } Diff } -- Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ 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
[R] using 'nice' with R
I would like to use the 'nice' command when running CPU-intensive R functions on a server. Will starting R with 'nice R' do the trick? -- Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ 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
Re: [R] Need your help with my R plot
On Mon, 7 Feb 2005, Latha Raja wrote: I am using R to plot the graph and the problem I am facing with my graph is that I have lots of points concentrated in one area and It is creating a visualization challenge. How about 'plot( ,pch='.', )? -- Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ 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
Re: [R] Re: [BioC] installing XML in linux
On 9 Jun 2003, Douglas Bates wrote: You will need to install the Debian package libxml-dev before you can install the R XML package. and note that the package is really looking for 'libxml/parser.h'. On my machine, for example, parser.h is in /usr/include/libxml2/libxml/, so I have LIBXML_INCDIR=/usr/include/libxml2. -- Robert Burrows, PhD New England Biometrics [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help