[R] cbind(NULL,zoo.object)?

2009-03-15 Thread Ajay Shah
Folks, I often build up R objects starting from NULL and then repeatedly using rbind() or cbind(). This yields code like: a - NULL for () { onerow - craft one more row a - rbind(a, onerow) } This works because rbind() and cbind() are forgiving when presented with a NULL arg: they act like

[R] Please help me to understand environments

2009-03-15 Thread Ajay Shah
I want to write: zap - function(v) { if (exists(v)) {rm(v)} } But of course this doesn't work because the rm() acts on v which is within zap() and doesn't affect the parent environment: x - 1 zap(x) x [1] 1 How would I make this zap() function work? -- Ajay Shah

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread hyena
Dear John, Thanks for the prompt reply! Sorry did not supply with more detailed information. The target model consists of three latent factors, general risk scale from Weber's domain risk scales, time perspective scale from Zimbardo(only future time oriented) and a travel risk

Re: [R] read.xls question

2009-03-15 Thread David Scott
On Sat, 14 Mar 2009, Mathew, Abraham T wrote: I'm an R newbie and had a question about the read.xls function. I've heard that this is often not a reliable function to use for importing data. However, I have created numerous xls files which contain information about voter turnout and

Re: [R] dispcrepancy between aov F test and tukey contrasts results with mixed effects model

2009-03-15 Thread Peter Dalgaard
lba...@montana.edu wrote: Hello, I have some conflicting output from an aov summary and tukey contrasts with a mixed effects model I was hoping someone could clarify. I am comparing the abundance of a species across three willow stand types. Since I have 2 or 3 sites within a habitat I have

[R] Stuck on building a package

2009-03-15 Thread Ajay Shah
Folks, I have a personal package which used to build fine. Today when I tried to build the package again, some errors popped up. Could you please help? When I paste the offending function into an R it works correctly. But the package build breaks. $ R CMD check ansecon * checking for working

Re: [R] full screen graph, and close x11

2009-03-15 Thread BaKaLeGuM
thx , i will look that. I'm both on windows and linux 2009/3/12 Eik Vettorazzi e.vettora...@uke.uni-hamburg.de Hi, see ?dev.off but I think (guessing you use a windows system), you would be better of in using win.metafile() instead of x11() in initiating the graph, see ?win.metafile

Re: [R] cbind(NULL,zoo.object)?

2009-03-15 Thread Gabor Grothendieck
I've just committed a fix to the zoo svn repository. You can grab it like this: source(http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/merge.zoo.R?rev=575root=zoo;) On Sun, Mar 15, 2009 at 2:54 AM, Ajay Shah ajays...@mayin.org wrote: Folks, I often build up R objects

Re: [R] read.xls question

2009-03-15 Thread Rodrigo Aluizio
To turn the function avaliable you have to load the library first, to do so: library(xlsReadWrite) Then you use your command read.xls. I'm suposing that you already had installed the xlsReadWrite package. A better alternative to this package is RODBC, which also read excel 2007 files. Take

Re: [R] read.xls question

2009-03-15 Thread Gabor Grothendieck
There are two read.xls functions: one is in gdata and one is in xlsReadWrite packages and neither is unreliable. You've simply not loaded the package. There is more info here and interfacing to Excel: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows You should read the

Re: [R] Please help me to understand environments

2009-03-15 Thread David Winsemius
You might want to look at rm to see how that function handles the problem. -- David Winsemius On Mar 15, 2009, at 3:14 AM, Ajay Shah wrote: I want to write: zap - function(v) { if (exists(v)) {rm(v)} } But of course this doesn't work because the rm() acts on v which is within zap() and

[R] Help_Unable to run glmer

2009-03-15 Thread Emma Stone
Can anyone help with this - I have been running glmer code for linear mixed models on my works pc, and am now working on my laptop (which is vista) and when I load the lme4 package i get the message below and I cannot run any models - any one have any ideas? Emma trying URL

Re: [R] Help_Unable to run glmer

2009-03-15 Thread David Winsemius
It's a 404 message. Try a repository that does have it. The CMU repository has a copy but the one you picked does not seem to have one at the moment. Maybe there was a run on the British bit and the bit banks are a wee short? http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/ --

Re: [R] persp plot + plotting grid lines

2009-03-15 Thread David Winsemius
This wiki page has the answer. Draw the plot first to establish the coordinate system and create the viewing transformation matrix. Draw the grid lines with lines(trans3d()), and then put a: par(new=T) ... and then redraw the plot over the gridlines.

Re: [R] Stuck on building a package

2009-03-15 Thread Duncan Murdoch
On 15/03/2009 4:46 AM, Ajay Shah wrote: Folks, I have a personal package which used to build fine. Today when I tried to build the package again, some errors popped up. Could you please help? Generally questions about building packages are better in R-devel. When I paste the offending

Re: [R] What is the best package for large data cleaning (not statistical analysis)?

2009-03-15 Thread Sean Zhang
Dear Jim: Thanks for your reply. Looks to me, you were using batching. I used batching to digest large data in Matlab before. Still wonder the answers to the two specifics questions without resorting to batching. Thanks. -Sean On Sat, Mar 14, 2009 at 10:13 PM, jim holtman jholt...@gmail.com

[R] Tukey, planned contrasts or t-test without ANOVA? What is correct?

2009-03-15 Thread J S
Dear R community, I compare mean monthly body temperature between two age classes of turtles overwintering underground. lm(body_tem ~ Month*Year*Age_Class) TukeyHSD(aov(body_tem ~ Month*Year*Age_Class, a)) The Tukey HSD as well as the planned contrasts method showed significant

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread John Fox
Dear hyena, -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of hyena Sent: March-15-09 4:25 AM To: r-h...@stat.math.ethz.ch Subject: Re: [R] SEM model testing with identical goodness of fits (2) Dear John, Thanks for

Re: [R] [OT] two question about color space.

2009-03-15 Thread baptiste auguie
I've put together a rough R port of that C code [*] in a package on r- forge: http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/spectral/?root=photonics http://r-forge.r-project.org/R/?group_id=160 ( package spectral, will be built overnight ) There is a lot of optimization and

Re: [R] primitives again

2009-03-15 Thread Wacek Kusnierczyk
Edna Bell wrote: How do I find the functions which are primitives, please? you can scan the whole search path for functions that are primitives: primitives = sapply(search(), function(path) with(as.environment(path), Filter(is.primitive, lapply(ls(), get primitives is a list

Re: [R] builtin vs. closure

2009-03-15 Thread Duncan Murdoch
On 15/03/2009 12:00 AM, Edna Bell wrote: Dear R Gurus: I'm working slowly through R Programming for Bioinformatics, which is really interesting! Anyway, my question now is: what determines if a function is a builtin vs. a closure, please? Closure is the normal type of function written in R

[R] Help plase with simple loop

2009-03-15 Thread Axel Urbiz
Dear All, I’m a new R user. How can I write code below more efficiently (using a loop for example)? f1 -function(par){x1 - par[1]; x2 - par[2];x3 - par[3] ; x4 - par[4] ; (1+x1)} f2 -function(par){x1 - par[1]; x2 - par[2];x3 - par[3] ; x4 - par[4] ;(1+x2)} f3 -function(par){x1 - par[1]; x2 -

Re: [R] What is the best package for large data cleaning (not statistical analysis)?

2009-03-15 Thread Josuah Rechtsteiner
Hi Sean, you should think about storing the data externally in a sql database. this makes you very flexible and you can do a lot of manipultaion directly in the db. with the help of stored procedures for example in a postgreSQL db you can use almost any preferred languege to manipulate

Re: [R] Help plase with simple loop

2009-03-15 Thread David Winsemius
I don't think you have gotten the basic idea of functions in R. Those functions would return only the value of the last evaluated expression, e.g. (1+par[1]) in the case of f1, but most of the code appears to have no effect. See this simple example: x1 - 4 f1 - function(x) x1 - x f1(1)

Re: [R] builtin vs. closure

2009-03-15 Thread Erin Hodgess
Thank you On Sun, Mar 15, 2009 at 8:36 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 15/03/2009 12:00 AM, Edna Bell wrote: Dear R Gurus: I'm working slowly through R Programming for Bioinformatics, which is really interesting! Anyway, my question now is:  what determines if a function

Re: [R] primitives again

2009-03-15 Thread Erin Hodgess
Thank you On Sun, Mar 15, 2009 at 8:23 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Edna Bell wrote: How do I find the functions which are primitives, please? you can scan the whole search path for functions that are primitives:    primitives = sapply(search(),

Re: [R] persp plot + plotting grid lines

2009-03-15 Thread Duncan Murdoch
On 15/03/2009 10:07 AM, Kingsford Jones wrote: Building on Duncan's code, here's an approximation to the Matlab 'peaks' plot referred to by Pedro: peaks - function(x, y) { 3 * (1-x)^2 * exp(-(x^2)-(y+1)^2) - 10 * (x/5-x^3-y^5) * exp(-x^2-y^2) - 1/3*exp(-(x+1)^2-y^2)} x - y - seq(-3,3,.1) z

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread hyena
Dear John, Thanks for the reply. Maybe I had used wrong terminology, as you pointed out, in fact, variables prob*, o* and v* are indicators of three latent variables(scales): weber, tp, and tr respectively. So variables prob*, o* and v* are exogenous variables. e.g., variable

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread William Revelle
Dear Hyena, Your model is of three correlated factors accounting for the observed variables. Those three correlations may be accounted for equally well by correlations (loadings) of the lower order factors with a general factor. Those two models are indeed equivalent models and will, as a

[R] Contour plots of four two-dimensional matrices

2009-03-15 Thread Thomas Levine
I have four large two-dimensional matrices of which I want to create contour plots. Something like filled.contour(matrix) contourplot(matrix) works but only gives me one plot at a time. If I combine the four matrices into one three-dimensional matrix, which I'll name seven, there should be a way

[R] xyplot of a specific ID number

2009-03-15 Thread Sachi Ito
Dear R list members, I have a question regarding xyplot. I managed to make a xyplot of all the IDs by using the syntax below: xyplot(PA ~ CRPC + CRPT | ID, data = redinteract) Now, I'd like to make a graph of a specific ID number (e.g., only ID number 301). I thought I could use subset, but it

Re: [R] Contour plots of four two-dimensional matrices

2009-03-15 Thread David Winsemius
What is it that you want to do with these 4 plots? Overlay them with different color contours or plot them side-by-side on the same page? ?par # for filled.contour but the implementation will be different for those two options. contourplot is is a lattice plotting function. See Figure

Re: [R] xyplot of a specific ID number

2009-03-15 Thread David Winsemius
Would have help if you had offered complete output for your efforts at using subset. This should work (on the assumption that ID is of type numeric): xyplot(PA ~ CRPC + CRPT , data = subset(redinteract, ID == 301) ) On Mar 15, 2009, at 12:35 PM, Sachi Ito wrote: Dear R list members, I

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread John Fox
Dear Hyena, OK -- I see that what you're trying to do is simply to fit a confirmatory factor-analysis model. The two models that you're considering aren't really different -- they are, as I said, observationally equivalent, and fit the data poorly. You can *assume* a common higher-level factor

Re: [R] xyplot of a specific ID number

2009-03-15 Thread Gabor Grothendieck
Using built in data frame CO2 try this where Type is a 2 level factor. library(lattice) xyplot(uptake ~ conc | Type, CO2) xyplot(uptake ~ conc | Type, CO2)[1] xyplot(uptake ~ conc | Type, CO2)[2] On Sun, Mar 15, 2009 at 12:35 PM, Sachi Ito s.ito@gmail.com wrote: Dear R list members, I have

Re: [R] dispcrepancy between aov F test and tukey contrasts results with mixed effects model

2009-03-15 Thread lbaril
Thanks Peter for the advice and quick response. I just want to clarify what you suggest. I should average values within a site then do a one-way anova to test for differnces between sites based on the 2 to 3 new samples per stand type -- and not use random effects for site? Or, because I've

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread hyena
Thanks for the clear clarification. The suggested bi-factor solution sounds attractive. I am going to check it in details. regards, William Revelle wrote: Dear Hyena, Your model is of three correlated factors accounting for the observed variables. Those three correlations may be accounted

[R] Yet another large file question.

2009-03-15 Thread rkevinburton
I am using the XML package to form a rather large XML file. It seems to go OK untill the file length gets larger than about 30Mb then it seems that the last tokens of the xml file are unmatched. It is almost like the file hasn't been flushed because the file is OK with the exception of the

Re: [R] Contour plots of four two-dimensional matrices

2009-03-15 Thread Thomas Levine
I want to plot them side by side. On Sun, Mar 15, 2009 at 12:41 PM, David Winsemius dwinsem...@comcast.netwrote: What is it that you want to do with these 4 plots? Overlay them with different color contours or plot them side-by-side on the same page? ?par # for filled.contour but the

[R] Axes crossing at origin

2009-03-15 Thread Markus Nenniger
Hi, I'm having a bit of trouble with the axes in my plots. I don't like the way R does not have them cross in the origin. Is there another plot/axis function? i tried using abline as suggested by someone from this list, but in my case this gives no satisfactory result, as the abline does

Re: [R] Contour plots of four two-dimensional matrices

2009-03-15 Thread David Winsemius
You would use layout to set up the page in base graphics. It sets up the page to receive multiple plots. Unfortunately, this will *not* give you side by side plots because filled.contour is restricted to a full page per its help page layout(matrix(c(1,2,3,4), 2,2 byrow=TRUE) for (i in 1:4)

Re: [R] SEM model testing with identical goodness of fits (2)

2009-03-15 Thread hyena
The purpose of carrying this CFA is to test the validity of a new developed scale tr with v* items, other two scales weber and tp are existing scales that measures specific risk attitudes. I am not sure if a simple correlation analysis is adequate to this purpose or not, thus the CFA test.

[R] mvpart error - is.leaf

2009-03-15 Thread Josh Stumpf
Hello, When trying to run mvpart either specifying my own parameters or using the defaults, I get the following error: Error in all(is.leaf) : unused argument(s) (c(FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE)) As far as I can tell, is.leaf is part of the dendrogam package, so I'm assuming

[R] Testing for Inequality à la select case

2009-03-15 Thread diegol
Using R 2.7.0 under WinXP. I need to write a function that takes a non-negative vector and returns the parallell maximum between a percentage of this argument and a fixed value. Both the percentages and the fixed values depend on which interval x falls in. Intervals are as follows: From |

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread baptiste auguie
Hi, I think you could get a cleaner solution using ?cut to split your data in given ranges (the break argument), and then using this factor to give the appropriate percentage. Hope this helps, baptiste On 15 Mar 2009, at 20:12, diegol wrote: Using R 2.7.0 under WinXP. I need to

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread Stavros Macrakis
On Sun, Mar 15, 2009 at 4:12 PM, diegol diego...@gmail.com wrote: ...This could be done in Excel much tidier in my opinion (especially the range_aux part), element by element (cell by cell)... If you'd do it element-by-element in Excel, why not do it element-by-element in R? Create a table

Re: [R] Tukey, planned contrasts or t-test without ANOV A? What is correct?

2009-03-15 Thread Dieter Menne
J S yulya258 at hotmail.com writes: I compare mean monthly body temperature between two age classes of turtles overwintering underground. lm(body_tem ~ Month*Year*Age_Class) TukeyHSD(aov(body_tem ~ Month*Year*Age_Class, a)) The Tukey HSD as well as the planned contrasts method showed

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread diegol
Hello Stavros, If you'd do it element-by-element in Excel, why not do it element-by-element in R? Well, actually I was hoping for a vectorized solution so as to avoid looping. I need to use this formula on rather lengthy vectors and I wanted to put R's efficiency to some good use. In any

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread diegol
Hello Baptiste, I am not very sure how I'd go about that. Taking the range, perc and min vectors from Stavros' response: range= c(20,100,250,700,1000,Inf)*1000 perc = c(65,40,30,25,20,0)/100 min = c(0,14,40,75,175,250)*1000 For range to work as the breaks argument to cut, I think

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread baptiste auguie
Hi, I don't use ?cut and ?split very much either, so this may not be good advice. From what I understood of your problem, I would try something along those lines, range= c(20,100,250,700,1000,Inf)*1000 perc = c(65,40,30,25,20,0)/100 min = c(0,14,40,75,175,250)*1000 range = c(0, range)

Re: [R] dispcrepancy between aov F test and tukey contrasts results with mixed effects model

2009-03-15 Thread Peter Dalgaard
lba...@montana.edu wrote: Thanks Peter for the advice and quick response. I just want to clarify what you suggest. I should average values within a site then do a one-way anova to test for differnces between sites based on the 2 to 3 new samples per stand type -- and not use random effects for

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread diegol
Hello Baptiste, Thanks so much for your help. This function which is basically your input wrapped with curly brackets seems to work alright: mr_2 - function(x){ range= c(20,100,250,700,1000,Inf)*1000 perc = c(65,40,30,25,20,0)/100 min = c(0,14,40,75,175,250)*1000

Re: [R] Problem with figure size when embedding fonts

2009-03-15 Thread Paul Johnson
On Sat, Mar 14, 2009 at 1:51 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Dear Colleagues: I need to make a graphic that uses the Nimbus rather than Helvetica font family so that the font can be embedded in the encapsulated postscript file.  This is to satisfy a requirement from a

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread Stavros Macrakis
Using cut/split seems like gross overkill here. Among other things, you don't need to generate labels for all the different ranges. which(x=range)[1] seems straightforward enough to me, but you could also use the built-in function findInterval. -s

[R] BOOTSTRAP_CROSS VALIDATION

2009-03-15 Thread per243
I need a script that works for Bootstrap validation. Could someone explain me when should I use the Bootstrap technical or Jackknife? Thanks -- View this message in context: http://www.nabble.com/BOOTSTRAP_CROSS-VALIDATION-tp22529500p22529500.html Sent from the R help mailing list archive at

Re: [R] primitives again

2009-03-15 Thread Berwin A Turlach
On Sun, 15 Mar 2009 14:23:40 +0100 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Edna Bell wrote: How do I find the functions which are primitives, please? you can scan the whole search path for functions that are primitives: primitives = sapply(search(),

[R] transfer function in R

2009-03-15 Thread Roger
I want to forecast a time series Y using a model that includes previous values of Y and an exogenous time series X using a transfer function. The standard procedure as described in Box and Jenkins and numerous other references is to first fit an ARIMA model to X. Use the ARIMA model to computer

Re: [R] Problem with figure size when embedding fonts

2009-03-15 Thread Frank E Harrell Jr
Paul Johnson wrote: On Sat, Mar 14, 2009 at 1:51 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Dear Colleagues: I need to make a graphic that uses the Nimbus rather than Helvetica font family so that the font can be embedded in the encapsulated postscript file. This is to satisfy a

Re: [R] Testing for Inequality à la select case

2009-03-15 Thread diegol
That's what I meant by element-by -element. A vector in R corresponds to a row or a column in Excel, and a vector operation in R corresponds to a row or column of formulae, e.g. Excel A B C 1) 5 10 a1+b1 (= 15) 2) 3 2 a2+b2 (= 5) etc. R A -

[R] Fw: Fitting GUMBEL Distribution - CDF function and P P Plot

2009-03-15 Thread Maithili Shiva
Dera R Helpers, I am re-posting my query. Please guide me. Maithili --- On Fri, 3/13/09, Maithili Shiva maithili_sh...@yahoo.com wrote: I am trying to fit the Gumbel distribution to a data. I am using lmom package. I am getting problem in Cumulative Distribution Function of Gumbel