[R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
Hello, I'd like to convert R data frames into xml-trees. I wrote (and copied) this little program to do this: convertToXML - function(df,name) { xml - xmlTree(Test) xml$addNode(name, close=FALSE) for (i in 1:nrow(df)) { xml$addNode(value, close=FALSE) for (j in names(df)) {

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread Dieter Menne
T.Wunder wrote: convertToXML - function(df,name) { xml - xmlTree(Test) xml$addNode(name, close=FALSE) for (i in 1:nrow(df)) { xml$addNode(value, close=FALSE) for (j in names(df)) { xml$addNode(j, df[i, j]) } xml$closeTag() } xml$closeTag()

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
Hello, Quoting Dieter Menne dieter.me...@menne-biomed.de: T.Wunder wrote: convertToXML - function(df,name) { xml - xmlTree(Test) xml$addNode(name, close=FALSE) for (i in 1:nrow(df)) { xml$addNode(value, close=FALSE) for (j in names(df)) { xml$addNode(j, df[i, j]) }

Re: [R] Novel (Maybe?) Visualizations

2010-02-12 Thread Liviu Andronic
On Fri, Feb 12, 2010 at 5:19 AM, stvienna wiener stvie...@gmail.com wrote:   - interactive input of graphs (or external program and import via GraphML) Perhaps latticist, rggobi? Is R the right programming language for that? (I think it is...) Are there any pointers? Books or tutorials on

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Tal Galili
Hi all, In Continue to this old thread, I just fixed a wordpress plugin to allow for R syntax highlighting using GeSHi version 1.0.8.6: http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/ Hope some of you will find it useful in the future. My thanks to all of

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread Dieter Menne
T.Wunder wrote: Well, now I get a warning message like In xmlRoot.XMLInternalDocument(currentNodes[[1]]) : empty XML document if I use this function. How could this be fixed? By telling use how you used that function. I'm sorry. I have a data frame df and typed

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
You were completely right with your guesses. I'm sorry, that I didn't told you all the details. Didn't think about that. Thanks for your help, Tom Quoting Dieter Menne dieter.me...@menne-biomed.de: T.Wunder wrote: Well, now I get a warning message like In

[R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Ramon Diaz-Uriarte
Dear All, For logistic regression models: is it possible to use validate (rms package) to compute bias-corrected AUC, but have variable selection with AIC use step (or stepAIC, from MASS), instead of fastbw? More details: I've been using the validate function (in the rms package, by Frank

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Linlin Yan
To achieve this goal, it seems there are several ways, such as WP-Syntax (http://wordpress.org/extend/plugins/wp-syntax/), SyntaxHighlighter2 (http://mohanjith.com/2009/03/syntaxhighlighter2.html), etc. However, these plugins seem not support R language by default, so you may have to write some

Re: [R] Formatting question for separate polygons

2010-02-12 Thread Uwe Ligges
On 11.02.2010 22:38, Tim Clark wrote: Dear List, I am trying to plot several separate polygons on a graph. I have figured out how to do it by manually, but have too much data to use such a tedious method. I would appreciate your help. I have made a simple example to illustrate the

[R] how to read csv file having variables unequal column sizes

2010-02-12 Thread Amelia Livington
Dear R helpers   Suppose e.g. I have a csv file having three variables defined and each of these variables have data items of say 40, 50, 45 length. When I open this csv file in 'R', I get 10 trailing 'NA's under first column and 5 'NA' s in case of 3rd column.   How do I get rid of these NA's

Re: [R] Using seq_len() vs 1:n]

2010-02-12 Thread Peter Ehlers
Pat Burns makes a good point. -Peter Original Message Subject: Re: [R] Using seq_len() vs 1:n Date: Fri, 12 Feb 2010 09:01:20 + From: Patrick Burns pbu...@pburns.seanet.com To: Peter Ehlers ehl...@ucalgary.ca References: 4b746aef.10...@ucalgary.ca If you want your code to

Re: [R] how to read csv file having variables unequal column sizes

2010-02-12 Thread Henrique Dallazuanna
Try this: #DF - read.table(...) lapply(DF, function(col)col[!is.na(col)]) On Fri, Feb 12, 2010 at 9:31 AM, Amelia Livington amelia_living...@yahoo.com wrote: Dear R helpers Suppose e.g. I have a csv file having three variables defined and each of these variables have data items of say 40,

Re: [R] Formatting question for separate polygons

2010-02-12 Thread Peter Ehlers
Nice, Uwe. Small correction: make that nrow=4: x1 - as.numeric(rbind(matrix(rep(x, each=2), nrow=4), NA)) -Peter Ehlers Uwe Ligges wrote: On 11.02.2010 22:38, Tim Clark wrote: Dear List, I am trying to plot several separate polygons on a graph. I have figured out how to do it by

Re: [R] Formatting question for separate polygons

2010-02-12 Thread Uwe Ligges
On 12.02.2010 12:54, Peter Ehlers wrote: Nice, Uwe. Small correction: make that nrow=4: x1 - as.numeric(rbind(matrix(rep(x, each=2), nrow=4), NA)) Whoops, thanks! Uwe -Peter Ehlers Uwe Ligges wrote: On 11.02.2010 22:38, Tim Clark wrote: Dear List, I am trying to plot several

[R] Lattice: How to implement varwidth analogous to graphics::boxplot in bwplot?

2010-02-12 Thread Johannes Graumann
Hello, Has anybody solved this? Thanks, Joh __ 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,

Re: [R] how to read csv file having variables unequal column siz

2010-02-12 Thread Ted Harding
On 12-Feb-10 11:48:15, Henrique Dallazuanna wrote: Try this: #DF - read.table(...) lapply(DF, function(col)col[!is.na(col)]) On Fri, Feb 12, 2010 at 9:31 AM, Amelia Livington amelia_living...@yahoo.com wrote: Dear R helpers Suppose e.g. I have a csv file having three variables defined

Re: [R] heplot3d / rgl : example causes R GUI to crash

2010-02-12 Thread Duncan Murdoch
On 10/02/2010 11:07 AM, Michael Friendly wrote: Duncan Murdoch wrote: On 10/02/2010 9:33 AM, Michael Friendly wrote: [Env: Tested under Win Xp, R 2.9.2 and R 2.10.1; sessionInfo() at end] This is probably a bug in rgl, and I can reproduce it. Bugs in contributed packages are best sent to

Re: [R] Switching Axis in Time Series plotting

2010-02-12 Thread Peter Ehlers
Assuming that you are using the xts package, try this: data(sample_matrix) sample.xts - as.xts(sample_matrix) open - as.vector(sample.xts[,1]) month - as.Date(time(sample.xts)) plot(open, month, type=l) -Peter Ehlers JSmaga wrote: Basically it works, but I use the xts format and the

[R] Odp: formatting do.call output

2010-02-12 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 11.02.2010 20:36:31: Hello, With a dataset that is about 1.4e6 rows long my.dat[seq(1:20),] date Cell_ID Classification WT_Depth Frac_ET_Satsfd 1999-04-08 974 3 3.5850830.244561400 1999-04-081188

[R] restricting coefficient value

2010-02-12 Thread Rosario Garcia Gil
Dear colleges, I am traying to restrict the value of one coefficient in my glm model, see example: medparmodel - glm(los ~ white * (-0.21) + type2 + type3 + hmo, family=poisson(), data=medpar) but this does not work, and searching in other help webpages I did not manage to get any good hint.

Re: [R] R connection with sql server 2005

2010-02-12 Thread vikrant
Hi all, Problem is solved. The solution is I needed to pass the whole string driver=SQL Server;server= 01hd166373 as a parameter and not only the servername. my-function(servername,dbname,dbtable){ library(RODBC) channel- odbcDriverConnect(paste(servername) init_data-

[R] looping problem

2010-02-12 Thread Roslina Zakaria
Hi r-users,   I have this code below but I don't understand the error message:   cumdensity - function(z) { alp  - 2.0165;   rho  - 0.868;   # simplified expressions   a  - alp-0.5   c1 - sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2 - sqrt(rho)/(1-rho)   t1 - exp(-z/(1-rho))   t2     -

[R] Function Fstats and p value

2010-02-12 Thread sebastien
Hello, I used the function Fstats (in the package strucchange) and would like to transform the F probability given by Fstats in P value. This transformation can be made while making a plot, but I need to have the numerical P value which are ploted... and I can't find out how to do. Here a is an

Re: [R] restricting coefficient value

2010-02-12 Thread Dimitris Rizopoulos
have a look at ?offset(). I hope it helps. Best, Dimitris Rosario Garcia Gil wrote: Dear colleges, I am traying to restrict the value of one coefficient in my glm model, see example: medparmodel - glm(los ~ white * (-0.21) + type2 + type3 + hmo, family=poisson(), data=medpar) but this

Re: [R] Function Fstats and p value

2010-02-12 Thread Peter Ehlers
sebastien wrote: Hello, I used the function Fstats (in the package strucchange) and would like to transform the F probability given by Fstats in P value. This transformation can be made while making a plot, but I need to have the numerical P value which are ploted... and I can't find out how to

[R] List to matrix or to vectors conversion

2010-02-12 Thread Juan Tomas Sayago
Dear list, I have a list with 1000 x1000 lines and columns do you know how I can convert it to matrrix or data.frame. Thanks. Juan -- Juan Tomás Sayago Universidad Central http://sites.google.com/site/juantomassayago/ Objetivo: Garantizar a cada ser humano que habite en el país, una cantidad

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Tal Galili
Hi Linlin, I am afraid I wasn't clear. In my post I fixed the current WP-Syntax plugin so it WILL support the R syntax :) The link to the article is: http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/ Best, Tal Contact

[R] using mle2 for multinomial model optimization

2010-02-12 Thread Benedikt Gehr
Hi there I'm trying to find the mle fo a multinomial model -*L(N,h,S¦x)*. There is only *N* I want to estimate, which is used in the number of successes for the last cell probability. These successes are given by: p^(N-x1-x2-...xi) All the other parameters (i.e. h and S) I know from somewhere

Re: [R] Function Fstats and p value

2010-02-12 Thread Achim Zeileis
On Fri, 12 Feb 2010, sebastien wrote: Hello, I used the function Fstats (in the package strucchange) and would like to transform the F probability given by Fstats in P value. This transformation can be made while making a plot, but I need to have the numerical P value which are ploted... and I

Re: [R] looping problem

2010-02-12 Thread jim holtman
Exactly what are you expecting the 'if' statement to do? By definition, the 'if' only takes a single value and your expression is probably a vector with many values and the error message is just saying it will use only the first value to determine what to do. Are you trying to check if 'any' or

Re: [R] Code find exact distribution for runs test?

2010-02-12 Thread Dale Steele
Wow! Your reply amply demonstrates the power of understanding the math (or finding someone who does) before turning on the computer. One last R question...how could I efficiently enumerate all distinguishable permutations of a vector of signs? vect - c( -1, -1, 1, 1, 1) permn(vect) #length:

Re: [R] List to matrix or to vectors conversion

2010-02-12 Thread Ted Harding
On 12-Feb-10 13:14:29, Juan Tomas Sayago wrote: Dear list, I have a list with 1000 x1000 lines and columns do you know how I can convert it to matrrix or data.frame. Thanks. Juan as.data.frame() will convert it to a dataframe. If you then apply as.matrix() to the result you will get a

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Linlin Yan
I have saw it now. Thank you for your excellent works. On Fri, Feb 12, 2010 at 9:15 PM, Tal Galili tal.gal...@gmail.com wrote: Hi Linlin, I am afraid I wasn't clear. In my post I fixed the current WP-Syntax plugin so it WILL support the R syntax :) The link to the article is:

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Frank E Harrell Jr
Ramon Diaz-Uriarte wrote: Dear All, For logistic regression models: is it possible to use validate (rms package) to compute bias-corrected AUC, but have variable selection with AIC use step (or stepAIC, from MASS), instead of fastbw? More details: I've been using the validate function (in

[R] Thread-safeness of unif_rand()?

2010-02-12 Thread Sebastian Bauer
Hello, I'm currently using the unif_rand() function of R to get a random number from the uniform distribution in the C-part of a R package. The unif_rand() is heavily used. Now I would like to spawn several threads within the package in which the function is also heavily used. Is it safe and

Re: [R] trouble with read.table and colClasses='raw'

2010-02-12 Thread Henrik Bengtsson
The OP may be interested in using low-level readBin() and writeBin() instead. One can then either assign dimension attributes to the object to access the data as a matrix/an array. Note that assigning dimension attributes will probably(?) allocate a copy. If that is not wanted, it is not that

Re: [R] Using contour3d: axes, plotting to file, with lattice

2010-02-12 Thread luke
Some of the examples in the JSS paper http://www.jstatsoft.org/v28/i01 might be useful for integrating contour3d results with lattice. luke On Thu, 11 Feb 2010, Waichler, Scott R wrote: I am looking for examples of how to plot with contour3d() to a PNG or PDF file, add axes and other

[R] Potential problem with subset !!!

2010-02-12 Thread Arnaud Mosnier
Dear useRs, Just a little post to provide the answer of a problem that took me some time to resolve ! Hope that reading this will permit the others to avoid that error. When using the subset function, writing subset (data, data$columnname == X) or subset (data, columnname == X) do the same

[R] Assign Name of Data Frame

2010-02-12 Thread mah
Hello R Experts, How can I assign the name of a data frame with the argument of a function? Specifically I am using RODBC to build local dataframes from SAS datasets on a remote server. I would like the local dataframe have the same name as the source SAS dataset, and the function below is what

Re: [R] Potential problem with subset !!!

2010-02-12 Thread Douglas Bates
On Fri, Feb 12, 2010 at 9:22 AM, Arnaud Mosnier a.mosn...@gmail.com wrote: Dear useRs, Just a little post to provide the answer of a problem that took me some time to resolve ! Hope that reading this will permit the others to avoid that error. When using the subset function, writing

[R] Is there a way to figure out what nonlocal variables and functions have been used in a function?

2010-02-12 Thread blue sky
x=10 f=function() {print('in f')} g=function() {f(); print(x)} g() Suppose I have the above code, I want to know what functions and variables have been used in the function g (in this case, f and x). Is there a function to do so? __

Re: [R] List to matrix or to vectors conversion

2010-02-12 Thread Dan davison
Ted.Harding at manchester.ac.uk writes: On 12-Feb-10 13:14:29, Juan Tomas Sayago wrote: Dear list, I have a list with 1000 x1000 lines and columns Lists have neither lines nor columns. Can you explain exactly what you have? E.g. show us the code that created your list? do you know how

Re: [R] Assign Name of Data Frame

2010-02-12 Thread Marc Schwartz
On Feb 12, 2010, at 8:19 AM, mah wrote: Hello R Experts, How can I assign the name of a data frame with the argument of a function? Specifically I am using RODBC to build local dataframes from SAS datasets on a remote server. I would like the local dataframe have the same name as the

Re: [R] Using seq_len() vs 1:n]

2010-02-12 Thread William Dunlap
The next version of S+ will have seq_len in it. Currently the CSAN package Rcompat contains it. Parsing the name seq_len can be a problem, since S+ 8.1 still allows the use of the underscore for assignment (it warns about its use, but allows it). Either parse your code file in R mode by calling

Re: [R] Using seq_len() vs 1:n]

2010-02-12 Thread Henrik Bengtsson
If S+ has seq(length=...), that would solve any parsing problems. /Henrik On Fri, Feb 12, 2010 at 4:59 PM, William Dunlap wdun...@tibco.com wrote: The next version of S+ will have seq_len in it.  Currently the CSAN package Rcompat contains it. Parsing the name seq_len can be a problem, since

Re: [R] How to get the source code for the assignment of a variable?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 1:38 AM, Sharpie ch...@sharpsteen.net wrote: djhurio wrote: I believe there is not such thing as source code for a variable. I believe if you define x=y*y, x is keeping only the values of y*y, but not how they were computed. Am I right? In general yes.  Basic

[R] Selective load of .First() function just for Rgui.exe

2010-02-12 Thread jgarcia
Hi all, I have a .First - function() {...} in the Rprofile.site file. Through .First() I'm adding several menus to the GUI to access several functions I've been developing for own use. However, I also need to launch R scripts silently in a batch way, and in this case I get the error message:

[R] Sweave

2010-02-12 Thread R Heberto Ghezzo, Dr
Hello, I am trying to start using Sweave. I copy the example from help Sweave testfile - system.file(Sweave, Sweave-test-1.Rnw, package = utils) ## enforce par(ask=FALSE) options(device.ask.default=FALSE) ## create a LaTeX file Sweave(testfile) ## This can be compiled to PDF by

Re: [R] heplot3d / rgl : example causes R GUI to crash

2010-02-12 Thread Michael Friendly
Duncan Murdoch wrote: I tracked this down. It's a bug in rgl, but likely also a bug in heplots. At line 93 of heplot3d.mlm.R, called from line 198 in the same file, there's a call texts3d(x[which.max(x[,2]),] + offset*ranges, adj=0, texts=label, color=col, lit=FALSE) At this

Re: [R] using mle2 for multinomial model optimization

2010-02-12 Thread Ravi Varadhan
Use Nelder-Mead as the method in optim. This will give you the correct solution. m1 - mle2(mfun, start=svec, vecpar=TRUE, fixed=svec[1:(l-1)], method=Nelder) Hope this is helpful, Ravi. Ravi Varadhan, Ph.D. Assistant

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Ramon Diaz-Uriarte
Dear Frank, Thanks a lot for your response. And apologies for the question, because the answer was obviously in the help. As for the caveats on selection: yes, thanks. I think I am actually closely following your book (eg., pp. 249 to 253), and one of the points I am trying to make to my

Re: [R] Sweave

2010-02-12 Thread Prof Brian Ripley
I've never heard of 'Portable MikeTex'. Is this (Portable) MiKTeX? What you are doing wrong is declaring texidvi to be pdflatex, and it simply is not. I think what you actually want is to include the MiKTeX bin directory in your path, or to set options(texi2dvi=) to the path to texi2dvi.exe

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Frank E Harrell Jr
Ramon Diaz-Uriarte wrote: Dear Frank, Thanks a lot for your response. And apologies for the question, because the answer was obviously in the help. As for the caveats on selection: yes, thanks. I think I am actually closely following your book (eg., pp. 249 to 253), and one of the points I am

Re: [R] Using contour3d: axes, plotting to file, with lattice

2010-02-12 Thread Waichler, Scott R
Some of the examples in the JSS paper http://www.jstatsoft.org/v28/i01 might be useful for integrating contour3d results with lattice. Thank you, Luke, for pointing me to your paper with examples beyond what is in R help. The example of using contour3d and wireframe in lattice in Section 4.4

[R] paired wilcox test on each row of a large dataframe

2010-02-12 Thread gauravbhatti
hI I have to calculate V statistic for each row of a large dataframe (28000). I can not use multtest package for paired wilcox test. I have been using for loop which are. Is there a way to speed the computation with another method like using apply or tapply? My data set looks like this:

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Ramon Diaz-Uriarte
Frank, let me make sure I understand: On Fri, Feb 12, 2010 at 5:57 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ramon Diaz-Uriarte wrote: Dear Frank, Thanks a lot for your response. And apologies for the question, because the answer was obviously in the help. As for the

Re: [R] Selective load of .First() function just for Rgui.exe

2010-02-12 Thread Duncan Murdoch
On 12/02/2010 11:22 AM, jgar...@ija.csic.es wrote: Hi all, I have a .First - function() {...} in the Rprofile.site file. Through .First() I'm adding several menus to the GUI to access several functions I've been developing for own use. However, I also need to launch R scripts silently in a

Re: [R] Access variables by string

2010-02-12 Thread Philipp Rappold
Thanks a lot guys, looks like there are -as usual- a gazillion options ;)) f = function(x, vars) x[complete.cases(x[vars]),] seems to be the most appropriate in my case though. Best Philipp Benilton Carvalho wrote: On Thu, Feb 11, 2010 at 4:18 PM, Philipp Rappold philipp.rapp...@gmail.com

[R] summary statistics for grouped data

2010-02-12 Thread jose romero
Hello list: Is there an easy way (preferably through one of the standard R packages) of obtaining summary statistics for grouped data? I could split the data into classes by hist, and then progressively calculate all the columns i need to obtain the mean and standard deviation, but i was

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Frank E Harrell Jr
Ramon Diaz-Uriarte wrote: Frank, let me make sure I understand: On Fri, Feb 12, 2010 at 5:57 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ramon Diaz-Uriarte wrote: Dear Frank, Thanks a lot for your response. And apologies for the question, because the answer was obviously in the

[R] expression() help

2010-02-12 Thread Peng Cai
Hi All, I'm trying to use expression() for y-label in plot(). I'm not able to write Average(space)PM(subscript)10. I'm trying: ylab=expression(Average PM[10]) and its not working, because of a space between Average and PM. Thanks, Peng [[alternative HTML version deleted]]

Re: [R] validate (rms package) using step instead of fastbw

2010-02-12 Thread Ramon Diaz-Uriarte
Thanks for clarifying it Frank. (Yes, no univariate screening prior to feeding the model to validate. And the bias correct I guess is from my spanglish factory of new terminology ;-) Best, R. On Fri, Feb 12, 2010 at 6:26 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ramon

Re: [R] summary statistics for grouped data

2010-02-12 Thread Greg Snow
There are several depending on what specifically you want to do. Some of the things to look at include: tapply, aggregate, the plyr package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] paired wilcox test on each row of a large dataframe

2010-02-12 Thread Dan Davison
gauravbhatti gaurav15984 at hotmail.com writes: hI I have to calculate V statistic for each row of a large dataframe (28000). I can not use multtest package for paired wilcox test. I have been using for loop which are. Is there a way to speed the computation with another method like

Re: [R] summary statistics for grouped data

2010-02-12 Thread Søren Højsgaard
You might find the summaryBy function in the doBy package useful. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af jose romero [jlauren...@yahoo.com] Sendt: 12. februar 2010 18:23 Til: r-help@r-project.org

Re: [R] expression() help

2010-02-12 Thread Henrique Dallazuanna
Try this: expression(Average~PM[10]) On Fri, Feb 12, 2010 at 3:29 PM, Peng Cai pengcaimaill...@gmail.com wrote: Hi All, I'm trying to use expression() for y-label in plot(). I'm not able to write Average(space)PM(subscript)10. I'm trying: ylab=expression(Average PM[10]) and its not

[R] R - Compiling and calling Fortran code that uses IMSL libraries - Help!

2010-02-12 Thread Nynese Tinsley
Good Afternoon R Help! On of my users is seriously thinking about moving to R from Splus. In his testing, he has already found some benefits to it. He has, however run into one issue, calling his Fortran functions in R. Previously, in Splus, he would do the following: 1. Compile via f90 the

Re: [R] summary statistics for grouped data

2010-02-12 Thread William Revelle
At 6:44 PM +0100 2/12/10, Søren Højsgaard wrote: You might find the summaryBy function in the doBy package useful. Regards Søren see also the describe.by function in the psych package. Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org]

[R] Y average in plot

2010-02-12 Thread Mohsen Jafarikia
Hello All: Can somebody please tell me how I can have the average of 'y' on the graph for different values of 'x in the following code? ofn - xy.png bitmap(ofn, type = png256, width = 21, height = 30, pointsize = 30, bg = white,res=50) ifn - sprintf(xy.txt) data - read.table(ifn)

[R] Code working but too slow, any idea for how to speed it up ?(no loop in it)

2010-02-12 Thread anna
Hello my friends, here is a code I wrote with no loops on matrix that is taking too long (2 seconds and I call him 720 times -- 12 minutes): mat1 and mat2 are both matrix with 103 columns and 164 rows. sequence - matrix(seq(1 : ncol(mat1))) returns - apply(sequence, 1, function, mat1= mat1,

Re: [R] Sweave

2010-02-12 Thread R Heberto Ghezzo, Dr
Thanks to Prof Ripley, I modified Rprofile.site with: .First - function() { Sys.setenv(JAGS_HOME=replace.substring.wild(R.home(), R-*, JAGS-1.0.3)) Sys.setenv(LATEX=replace.substring.wild(R.home(),R*,PortableUSB/PortableApps/MikeTex/miktex/bin/latex.exe)) PathNew -

[R] svm and RMSE

2010-02-12 Thread Amy Hessen
Hi, Every time I run a svm regression program, I got different RMSE value. Could you please tell me what the reason for that? Cheers, Amy _ If it exists, you'll find it on SEEK.

Re: [R] Is there a way to figure out what nonlocal variables and functions have been used in a function?

2010-02-12 Thread Sharpie
blue sky wrote: x=10 f=function() {print('in f')} g=function() {f(); print(x)} g() Suppose I have the above code, I want to know what functions and variables have been used in the function g (in this case, f and x). Is there a function to do so? Try findGlobals() from the

Re: [R] Code find exact distribution for runs test?

2010-02-12 Thread Greg Snow
Here is one quick way using the combinat package: library(combinat) tmpfun - function(x) { + tmp - rep(1,5) + tmp[x] - -1 + tmp + } combn(5,2, tmpfun) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -1 -1 -1 -111111 1 [2,] -1111

[R] Execution timing in .First()

2010-02-12 Thread gerald . jean
Hello, I have a .First function in my personnal Rprofile file. Through the .First function I want to load an R data base at position 2 in the search list but R complains with: Attempting to load the environment 'package:stats' and further down the initialization process, when .First.sys() is

Re: [R] Assign Name of Data Frame

2010-02-12 Thread Mike Harwood
Marc, Thank you for your help. I had tried assign, but I did not enclose the table name in quotes in my function call. I needed to see what someone else had written before I ever would have noticed it! On Fri, Feb 12, 2010 at 10:00 AM, Marc Schwartz marc_schwa...@me.comwrote: On Feb 12,

Re: [R] using mle2 for multinomial model optimization

2010-02-12 Thread Ben Bolker
Ravi Varadhan rvaradhan at jhmi.edu writes: Use Nelder-Mead as the method in optim. This will give you the correct solution. m1 - mle2(mfun, start=svec, vecpar=TRUE, fixed=svec[1:(l-1)], method=Nelder) Hope this is helpful, Ravi. Well-meaning though it is, this solution doesn't

[R] help with EXPASY HTML form submission in RCurl package

2010-02-12 Thread Sunando Roy
Hi, I am trying to submit a form to the EXPASY protscale server ( http://www.expasy.ch/tools/protscale.html). I am using the RCurl package and the postForm function available in it. I have extracted the variables for the form from the HTML source page. According to the syntax of postForm, I just

Re: [R] using mle2 for multinomial model optimization

2010-02-12 Thread Ben Bolker
Ravi Varadhan rvaradhan at jhmi.edu writes: Use Nelder-Mead as the method in optim. This will give you the correct solution. m1 - mle2(mfun, start=svec, vecpar=TRUE, fixed=svec[1:(l-1)], method=Nelder) Hope this is helpful, Ravi. {Resending because it doesn't seem to have gone

Re: [R] Code working but too slow, any idea for how to speed it up ?(no loop in it)

2010-02-12 Thread Ravi Varadhan
First of all, please send a reproducible code. Your code is wrong and it does not execute: naming a function called function is a bad idea. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and

[R] Access dataframe with variable name in function

2010-02-12 Thread Philipp Rappold
Sorry guys, but I have another one: I want to write a function that returns a certain column of a dataframe. The function accepts two argument: the dataframe and the name of the column, but the column is not given as a string but as a variable name. EXAMPLE --

Re: [R] expression() help

2010-02-12 Thread Thomas Lumley
On Fri, 12 Feb 2010, Peng Cai wrote: Hi All, I'm trying to use expression() for y-label in plot(). I'm not able to write Average(space)PM(subscript)10. I'm trying: ylab=expression(Average PM[10]) and its not working, because of a space between Average and PM. Thanks, quote(Average PM[10])

[R] Help with submitting HTML forms in RCurl

2010-02-12 Thread Sunando Roy
Hi, I am trying to submit a form to the EXPASY protscale server ( http://www.expasy.ch/tools/protscale.html). I am using the RCurl package and the postForm function available in it. I have extracted the variables for the form from the HTML source page. According to the syntax of postForm, I just

[R] (no subject)

2010-02-12 Thread Drew Smathers
Sent from my iPod __ 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.

Re: [R] Access dataframe with variable name in function

2010-02-12 Thread Sharpie
Philipp Rappold wrote: Sorry guys, but I have another one: I want to write a function that returns a certain column of a dataframe. The function accepts two argument: the dataframe and the name of the column, but the column is not given as a string but as a variable name. k -

Re: [R] help with EXPASY HTML form submission in RCurl package

2010-02-12 Thread Duncan Temple Lang
Sunando Roy wrote: Hi, I am trying to submit a form to the EXPASY protscale server ( http://www.expasy.ch/tools/protscale.html). I am using the RCurl package and the postForm function available in it. I have extracted the variables for the form from the HTML source page. According to the

Re: [R] Code working but too slow, any idea for how to speed it up ?(no loop in it)

2010-02-12 Thread Bert Gunter
?profile Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of anna Sent: Friday, February 12, 2010 10:29 AM To: r-help@r-project.org Subject: [R] Code working but too slow, any idea for how

Re: [R] Formatting question for separate polygons

2010-02-12 Thread Tim Clark
Thanks Uwe! And Peter for the correction. I would never have come up with that! Tim Tim Clark Department of Zoology University of Hawaii --- On Fri, 2/12/10, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: From: Uwe Ligges lig...@statistik.tu-dortmund.de Subject: Re: [R] Formatting

Re: [R] help with EXPASY HTML form submission in RCurl package

2010-02-12 Thread Sunando Roy
Hi Duncan, Thanks for your help. I changed the P but the output that I get is not what I expect. The form gets aborted without any actual output. I get the same result with postForm(http://www.expasy.ch/tools/protscale.html;) just with an added message that there was no input passed on. But

Re: [R] Access dataframe with variable name in function

2010-02-12 Thread Dennis Murphy
Hi: Hi: Observe that if you quote the name of the variable in your original function, everything is fine; in fact, you can ask for multiple variables. k - function(df, col) df[col] k(testdata, 'var1') var1 1 0.91663902 2 0.60470753 3 0.09599891 k(testdata, 'censor') censor 1 0

Re: [R] Is there a way to figure out what nonlocal variables and functions have been used in a function?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 1:36 PM, Sharpie ch...@sharpsteen.net wrote: blue sky wrote: x=10 f=function() {print('in f')} g=function() {f(); print(x)} g() Suppose I have the above code, I want to know what functions and variables have been used in the function g (in this case, f and x). Is

[R] mgcv problem

2010-02-12 Thread Rosa Manrique
My dearest, I appreciate very much a little help. I have changed my R 2.9 version to the new one R 2.10 version. I uninstall the old one, I cancel also the old library and I install everything again. When I load the package mgcv it appears the following message: This is mgcv 1.6-1. For overview

Re: [R] for loop function output

2010-02-12 Thread Chris Campbell
On Fri, Feb 12, 2010 at 01:26, seydahmet ercan seydahmeter...@gmail.com wrote: Hello all, I am trying to run a simulation. the simulation presented below. rep=5 sr=.10 # selection ratio pmin=.10 # minority ratio nap=1000 # total number of applicant nsle=sr*nap # number of ee selected

Re: [R] Code find exact distribution for runs test?

2010-02-12 Thread Peter Ehlers
Here's a simple function (same idea): f - function(x){ lenx - length(x) negx - sum(x 0) mat - matrix(1, lenx, choose(lenx,negx)) for(i in seq_len(choose(lenx, negx))){ mat[combn(lenx,negx)[, i], i] - -1 } mat } x - c(-1,-1,-1,1,1,1,1) f(x) [combn() is now in utils] -Peter

[R] Logistic regression with weights?

2010-02-12 Thread Mark Miller
I created a logistic regression model for the data set immediately below and obtained the following parameter estimates: Coefficients : Estimate Std. Error t-value Pr(|t|) altc -0.064539 0.359398 -0.1796 0.8575 alts -0.287682 0.381881 -0.7533 0.4513 Then I reformatted the data

Re: [R] Code working but too slow, any idea for how to speed it up ?(no loop in it)

2010-02-12 Thread Dan Davison
anna lippelanna24 at hotmail.com writes: Hello my friends, here is a code I wrote with no loops on matrix that is taking too long (2 seconds and I call him 720 times -- 12 minutes): mat1 and mat2 are both matrix with 103 columns and 164 rows. Could you provide some example code creating

[R] Multiple figures margin problem

2010-02-12 Thread mnstn
Hello All, I am trying to make a figure with 3x2 plots in it. Let us name the plots as such: 1 2 3 4 5 6 I begin my script with: par(mfcol=c(3,2)) par(oma=c(0,0,0,0)) -- This is for a postscript figure so I really don't need the outer margins. d=5 par(mar=c(d,d,d,d)) -- This applies

[R] popbio and stochastic lambda calculation

2010-02-12 Thread Shawn Morrison
Hello R users, I am trying to calculate the stochastic lambda for a published matrix population model using the popbio package. Unfortunately, I have been unable to match the published results. Can anyone tell me whether this is due to slightly different methods being used, or have I gone

[R] logical operations with lists

2010-02-12 Thread Zoppoli, Gabriele (NIH/NCI) [G]
Sorry, maybe it's easy but I haven't found anything useful: how can I obtain a list C that contains all the members in the list B that are not in list A? This are lists of nanes, not numbers! Thank you Gabriele Zoppoli, MD Ph.D. Fellow, Experimental and Clinical Oncology and Hematology,

  1   2   >