[R] certain number of equations in function depending on parameter

2007-09-19 Thread Andreas Wittmann
Hello everybody, i have the following problem to write a function which recognizes depending on the parameter-inputs how many equations for the calculation in the function are needed. Here is an example of my problem: myfun - function(a, b, c, d) { k - length(a) #here d = 3 for

Re: [R] Creating Hmisc labels inside a function

2007-09-19 Thread Steve Powell
Thanks again Frank for quick reply. True, someobject=2 Test=function(obj,labe) { label(obj)=labe #at this point add the line: obj } Test(someobject,somelabel) #returns a label. But if you retype someobject #the label has gone. That is what I meant by the label not being

Re: [R] SEM - standardized path coefficients?

2007-09-19 Thread Steve Powell
Dear list members, In sem, std.coef() will give me standardized coefficients from a sem model. But is there a trick so that path.diagram can use these coefficients rather than unstandardized ones? Thanks Steve Powell From: John Fox jfox_at_mcmaster.ca Date: Wed 28 Feb 2007 - 14:37:22 GMT Dear

[R] lmer using quasibinomial family

2007-09-19 Thread Alexandre Courtiol
Dear all, I try to consider overdispersion in a lmer model. But using family=quasibinomial rather than family=binomial seems to change the fit but not the result of an anova test. In addition if we specify test=F as it is recomanded for glm using quasibinomial, the test remains a Chisq test. Are

Re: [R] recommended package/docs for analyzing multiple choice tests

2007-09-19 Thread Dimitris Rizopoulos
In ltm (version 0.8-1) you may also check the following functions: descript(), cronbach.alpha(), mult.choice() I hope it helps. Best, Dimitris ps, you may find more information about `ltm' as well as sample analysis files at the Rwiki page:

[R] independent plotting of predicted terms with gamlss

2007-09-19 Thread Nikolaus Umlauf
Hi! I want to create a plot of a predicted term similar to the function term.plot() in the gamlss package. I have tried several options, but I could not work it out so far... Thank you for your help! Nikolaus here is my example: library(gamlss) data(rent) attach(rent) # Estimating some model

[R] x and y coordinates (Rfwdmv Package)

2007-09-19 Thread J. Däbritz
Hello R users, before asking my question I'd like to stress that I'm an (absolute) beginner in using R, but enthused about the incredible possibilities of it. So I hope my questions are not too stupid. Here's my problem: I have a dataset with skewed distributions. In order to obtain approx

[R] x and y coordinates (Rfwdmv Package)

2007-09-19 Thread gigis.mail
Hello R users, before asking my question I'd like to stress that I'm an (absolute) beginner in using R, but enthused about the incredible possibilities of it. So I hope my questions are not too stupid. Here's my problem: I have a dataset with skewed distributions. In order to obtain approx

Re: [R] handling multiple files; was: R advice

2007-09-19 Thread Uwe Ligges
Handling multiple files automatically is easy in R and has been answered several times on this list: please pok up the archives as suggested in the posting guide to this list which also asks you to use a sensible subject line. Additionally, there is a FAQ entry called How can I save the result

Re: [R] glmpath error

2007-09-19 Thread Duncan Murdoch
Tirthadeep wrote: Hi, I am using glampath package for L1 regularized logistic regression. I got the following error messege. model.fit - glmpath(train.data[,1:20], train.data$RES, family=binomial) Error in one %*% x : requires numeric matrix/vector arguments where train.data is

[R] layout function for several plots

2007-09-19 Thread marcg
Dear all I try to print 9 plots on a page, arranged as the code shows below. nf - layout(matrix(c(1,0,2,0,0,3,0,4,0,5,0,6,0,0,0,0,7,0,8,9), 10,2)) layout.show(nf) but when I try to plot, an error message Fehler in plot.new() : Grafikränder zu groß appears to verify p.e. with

Re: [R] glmpath error

2007-09-19 Thread Tirthadeep
Then what is the solution? Duncan Murdoch-2 wrote: Tirthadeep wrote: Hi, I am using glampath package for L1 regularized logistic regression. I got the following error messege. model.fit - glmpath(train.data[,1:20], train.data$RES, family=binomial) Error in one %*% x :

[R] Running tcltk From a batch file

2007-09-19 Thread Samuel Kemp
Hi, I am trying to run some simple tktcl code ## in a file called test.R require(tcltk) tt - tktoplevel() OK.but - tkbutton(tt,text=OK,command=function()tkdestroy(tt)) tkgrid(OK.but) tkfocus(tt) Using a batch file with the command Rterm test.R testOutput.Rout --slave The GUI pops up but

Re: [R] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2007-09-19 Thread Vladimir Eremeev
http://cran.r-project.org/mirror-howto.html Arin Basu-3 wrote: Dear All, Folks at the West Bengal University of Technology has set up a mirror to distribute R and associated packages. Here is the URL: http://mirror.wbut.ac.in/CRAN This will be helpful for R users in South Asia and

Re: [R] function on factors - how best to proceed

2007-09-19 Thread Gustaf Rydevik
On 9/19/07, Karin Lagesen [EMAIL PROTECTED] wrote: Gustaf Rydevik [EMAIL PROTECTED] writes: The second warning message tells you that: 2: the condition has length 1 and only the first element will be used in: if (terminus origin) You are comparing two vectors, which generate a

[R] apply

2007-09-19 Thread Roger Mason
Hello, I have a list of filenames extracted from a data-frame thus: files - main$file e.g. file[[1]] returns [1] Ca00Mn48_0.gout 4702 Levels: Ca00Mn48_0.gout Ca01Mn47_0.gout Ca01Mn47_1.gout ... Ca48Mn00_0.gout I want to extract the substring that contains the two digits after Ca. This works

Re: [R] apply

2007-09-19 Thread Dimitris Rizopoulos
it also works with vectors, e.g. x - c(Ca00Mn48_0.gout, Ca01Mn47_0.gout, Ca01Mn47_1.gout, Ca48Mn00_0.gout) substr(x, 3, 4) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address:

Re: [R] Running tcltk From a batch file

2007-09-19 Thread Peter Dalgaard
Jonne Zutt wrote: Hi Samuel, An easy solution is the following. Let the R script wait until a certain variable (ok_to_quit) got changed. Hope it helps, Jonne. ## in a file called test.R quit - function() { .Tcl(set ok_to_quit 1) tkdestroy(tt) } require(tcltk) tt - tktoplevel()

[R] (no subject)

2007-09-19 Thread marcg
Dear all I try to print 9 plots on a page, arranged as the code shows below. nf - layout(matrix(c(1,0,2,0,0,3,0,4,0,5,0,6,0,0,0,0,7,0,8,9), 10,2)) layout.show(nf) but when I try to plot, an error message Fehler in plot.new() : Grafikränder zu groß appears to verify p.e. with

Re: [R] By() with method = spearman

2007-09-19 Thread Sundar Dorai-Raj
Hi, Harold, In cases like this I usually add some print info to the function. E.g. tmp$Grade - factor(tmp$Grade) lapply(split(tmp, f = tmp$Grade), function(x) { z - x[,c(mtsc07,DCBASmathscoreSPRING)] print(levels(factor(z$Grade))) print(summary(z))

[R] micEcon: selection(,method=ml) . Predict method?

2007-09-19 Thread Werner Wernersen
Hi, as I read, maximum likelihood is the better method for estimating selection-biased models. But I also want to predict from that model. Is there any predict method for the selection function when using maximum likelihood estimation in micEcon? I couldn't find any. Many thanks, Werner

Re: [R] Robust or Sandwich estimates in lmer2

2007-09-19 Thread Thomas Lumley
On Wed, 19 Sep 2007, Doran, Harold wrote: This has come up before and I'll again ask the question why would you want robust standard errors in lmer? And I'll again answer: using lmer() does not automatically guarantee correct model specification, either for the correlation structure or for

Re: [R] Row-by-row regression on matrix

2007-09-19 Thread Charles C. Berry
system.time( lm( t(y) ~ x ) ) user system elapsed 0.008 0.000 0.010 On Wed, 19 Sep 2007, [EMAIL PROTECTED] wrote: Folks, I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a 4-vector (x) to create a matrix lm.y of intercepts and slopes. To illustrate:

Re: [R] Robust or Sandwich estimates in lmer2

2007-09-19 Thread Abdus Sattar
Hi Doran, My interests to estimate fixed effects parameters in a mixed model (not the random effects parameters) and, in addition, in the model there are some nuisace parameters. For this estimation I am using pseudo-maximum likelihood methods. First I am estimating nuisance parameters then

Re: [R] How to pass a string as an argument to a function?

2007-09-19 Thread Vladimir Eremeev
lme(as.formula(paste(y~,ww)),random=~1|subj,model) Gang Chen-3 wrote: I want to pass a predefined string ww (fa*fb+fc) to function lme so that I can run lme(y ~ fa*fb+fc, random = ~1|subj, model) There must be a simple way to do this. Any help? Thanks, Gang -- View this

Re: [R] How to pass a string as an argument to a function?

2007-09-19 Thread Gang Chen
Yes, as.formula is the magic tool! Thanks a lot... Gang On Sep 19, 2007, at 2:00 PM, Vladimir Eremeev wrote: lme(as.formula(paste(y~,ww)),random=~1|subj,model) Gang Chen-3 wrote: I want to pass a predefined string ww (fa*fb+fc) to function lme so that I can run lme(y ~ fa*fb+fc,

Re: [R] layout function for several plots

2007-09-19 Thread Greg Snow
Using ann=F just tells R not to put anything in the margins, it does not reduce the size of the margins. You need to reduce the margin size using par(mar= ...) with appropriate values. You can then shrink what goes in the margins rather than not plotting it at all (though that is a good first

[R] Smooth line in graph

2007-09-19 Thread Nestor Fernandez
Hi, I’m trying to get smooth curves connecting points in a plot using spline but I don’t get what I whant. Eg.: x-1:5 y - c(0.31, 0.45, 0.84, 0.43, 0.25) plot(x,y) lines(spline(x,y)) Creates a valley between the first and second points, then peaks at 3rd, and another valley between 4th and

Re: [R] layout function for several plots

2007-09-19 Thread Prof Brian Ripley
On Wed, 19 Sep 2007, Greg Snow wrote: Using ann=F just tells R not to put anything in the margins, it does not reduce the size of the margins. You need to reduce the margin size using par(mar= ...) with appropriate values. You can then shrink what goes in the margins rather than not

Re: [R] Smooth line in graph

2007-09-19 Thread Katharine Mullen
how about: require(splines) x-1:5 y - c(0.31, 0.45, 0.84, 0.43, 0.25) yy -predict(interpSpline(x, y)) plot(x, y) lines(yy) Katharine Mullen mail: Department of Physics and Astronomy, Faculty of Sciences Vrije Universiteit Amsterdam, de Boelelaan 1081 1081 HV Amsterdam, The Netherlands

Re: [R] Smooth line in graph

2007-09-19 Thread Greg Snow
Try: lines(spline(x,y, method='n', n=250)) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nestor Fernandez Sent: Wednesday,

[R] fCalendar

2007-09-19 Thread stephen bond
is there a straigthforward way to get the holidays for Toronto ? like the function for NYSE e.g. the timeDate class says that setting a finCenter will give the right holidays, but how? thank you very much. stephen __ R-help@r-project.org mailing

[R] Subset any value and blanks

2007-09-19 Thread Spilak,Jacqueline [Edm]
Hi everyone I need help with subseting a data set. In my dataset there is a specific row that will either have a value or be blank. I would like to subset (or split) the dataset into one dataset with the row that has the value and another dataset that has just the blanks. Now the thing is that

Re: [R] how to find p in binomial(n,p)

2007-09-19 Thread Mike Meredith
I think the function you need is 'help.search'; try: help.search(binomial) and look for something obvious in the 'stats' package. A good deal quicker and easier than posting to an internet forum! Cheers, Mike. cathelf wrote: Dear all, I am trying a find the value p in binomial. X ~

Re: [R] how to find p in binomial(n,p)

2007-09-19 Thread Ted Harding
On 19-Sep-07 23:04:57, Mike Meredith wrote: I think the function you need is 'help.search'; try: help.search(binomial) and look for something obvious in the 'stats' package. A good deal quicker and easier than posting to an internet forum! Cheers, Mike. Well ...

Re: [R] fontsize in mosaic plot lables

2007-09-19 Thread Alexander.Herr
Thanks Patric, mosaic{vdc} takes gpar parameters. So cex.axis does not work for mosaic(Titanic, pop=FALSE, labeling_args=list(rot_labels=c(bottom=90,top=90),cex.axis=0.5)) or mosaic(Titanic, pop=FALSE, labeling_args=list(rot_labels=c(bottom=90,top=90)),cex.axis=0.5) However, mosaic(Titanic,

Re: [R] function on factors - how best to proceed

2007-09-19 Thread Gustaf Rydevik
On 9/19/07, Karin Lagesen [EMAIL PROTECTED] wrote: Sorry about this one being long, and I apologise beforehand if there is something obvious here that I have missed. I am new to creating my own functions in R, and I am uncertain of how they work. I have a data set that I have read into a

Re: [R] Subset any value and blanks

2007-09-19 Thread jim holtman
You can use 'split' to create a list of dataframes and then operate on them: Day Month Year Time Hits Misses F.type 1 0101 1999 0600 120 80 0600 2 0101 1999 1015 300 10 3 0101 1999 1216 250 50 1216 4 0101 1999 1649 380 0 5 0101 1999 2132 1100

Re: [R] Factor levels

2007-09-19 Thread Gabor Grothendieck
If you don't know ahead of time how many columns you have and only that they are a mix of numeric and character (to be converted to factor) then you can do this: DF - read.table(textConnection(Input), header = TRUE, as.is = TRUE) f - function(x) if (is.character(x)) factor(x, levels = unique(x))

[R] R-related: problem with openvt on Ubuntu 7.04

2007-09-19 Thread bbolker
This is a configuration/OS problem, but it's affecting my use of R ... Whenever I try to open _any_ vignette (as far as I can tell) from within R, I get Could not get a file descriptor referring to the console, coming from /usr/bin/openvt, which is pointed to by /usr/bin/open, which is

Re: [R] Need help on date

2007-09-19 Thread Gabor Grothendieck
If you are interested in regular expressions you may also be interested in a solution using the gsubfn package. Here x is the input character string, re is Jeffrey's regular expression and strapply applies the regular expression to x calling the function which is represented in formula notation

Re: [R] Identify and plotting symbols. [SEC=UNCLASSIFIED]

2007-09-19 Thread Crombie, Joe
Rolf turner wrote: I have been trying, unsuccessfully, to use identify() to (simply) return a list of the indices of points clicked on and overplot (with say a solid dot) each clicked-on point so that I can see where I've been. I.e. I don't want to see the indices printed on the screen; I

[R] SHLIB problem under Vista

2007-09-19 Thread Anand Patil
Hi all, I'd like to distribute an R package that compiles some (small) C functions every time it's sourced. The relevant code in the top level R script is as follows: system(R CMD SHLIB Selma_extensions.c) if (.Platform$OS.type==windows) { slash = '\\' dyn.load(Selma_extensions.dll) }

Re: [R] fontsize in mosaic plot lables

2007-09-19 Thread Patrick Connolly
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, 20 September 2007 11:38 a.m. To: Patrick Connolly; [EMAIL PROTECTED] Subject: RE: [R] fontsize in mosaic plot lables Thanks Patric, mosaic{vdc} takes gpar parameters. So cex.axis does not work for OK, my mistake. I was

Re: [R] Identify and plotting symbols. [SEC=UNCLASSIFIED]

2007-09-19 Thread Crombie, Joe
Or maybe: while(length(ind - identify(x,y,n = 1, plot = F))) points(x[ind], y[ind], pch = 19) (highlights each point as you select it, until you click _stop_) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Crombie, Joe Sent: Thursday, 20 September