Re: [R] Question scatterplot axis cut point

2012-02-14 Thread Jim Lemon
On 02/14/2012 06:19 AM, Michael Methlagl wrote: Hi everybody, i made a scatterplot using the command plot (datafile1, xlim=c(0,10), ylim=c(0.001, 1), log=y, xlab=x Achse, ylab=y Achse, frame.plot=FALSE, axes = TRUE). Now i have a problem. There is a gap between the x and the y axis. I want

Re: [R] non-isomorphic sequences

2012-02-14 Thread Petr Savicky
Dear Wei: When I have a matrix s, with each column represents a sequence. I want to recover all equivalent sequences from the sequences/columns in s. I used this command   do.call(cbind,apply(s,2,function(x) getEquivalent(x,tt)))   This did a good job when ncol(s) 1, but when ncol(s)=1,

Re: [R] Writing R-scripts

2012-02-14 Thread Jim Lemon
On 02/14/2012 08:59 AM, Cem Girit wrote: Hello, This is my first attempt to write a script in R. The program below is intended to do some parametric tests on group data. There are subroutines for each type of test. The call to the parametric.tests, routine sets the argument testtype for

[R] Modular coding in R, OOP

2012-02-14 Thread deivit
Hi all, I've been having a look to all OOP functionallity in R, basically I've been reading Statistics and Computing book by Chambers. My problem is that I'm thinking about refactoring many functions of the applications I work with (which is quite huge), in order to modularize its components. I

[R] packfor

2012-02-14 Thread Krista Köllner
I want to install the R package packfor on my library in R (R-2.14.0), but I can not download it from http://r-forge.r-project.org/R/?group_id=195. Is it because of the Building status? Were can I get packfor from? Thanks a lot, Krista -- __

Re: [R] mgcv: increasing basis dimension

2012-02-14 Thread Simon Wood
That's interesting. Playing with the example, it doesn't seem to be a local minimum. I think that this happens because, although the higher rank basis contains the lower rank basis, the penalty can not simply suppress all the extra components in the higher rank basis and recover exactly what

Re: [R] packfor

2012-02-14 Thread Achim Zeileis
On Tue, 14 Feb 2012, Krista Köllner wrote: I want to install the R package packfor on my library in R (R-2.14.0), but I can not download it from http://r-forge.r-project.org/R/?group_id=195. Is it because of the Building status? Yes, exactly. Were can I get packfor from? The last

[R] cumsum formula to determine plankton phenology

2012-02-14 Thread Heather Anne Wright
Dear R-users -- -- Heather Anne --- Heather A. Wright, PhD candidate Ecology and Evolution of Plankton Stazione Zoologica Anton Dohrn Villa Comunale 80121 - Napoli, Italy

[R] question

2012-02-14 Thread Soheila Khodakarim
I have this matrix in R, s1 s2 s3 s4 g1 1 0 0 0 g1 0 1 0 0 g1 0 0 1 0 g2 1 0 0 0 g2 0 1 0 0 g3 1 0 0 0 g4 0 0 1 0 g4 1 0 0 0 g4 0 1 0 0 g4 0 0 0 1 I want to split this matrix based on its rows then sum based on columns, finally I want to make this

Re: [R] question

2012-02-14 Thread R. Michael Weylandt
Perhaps something (untested) like sapply(split(x, rownames(x)), colSums) Next time it's suggested you use dput() to send your data. Michael On Tue, Feb 14, 2012 at 7:08 AM, Soheila Khodakarim lkhodaka...@gmail.com wrote: I have this matrix in R,   s1 s2 s3 s4 g1  1  0  0  0 g1  0  1  0  

Re: [R] mgcv: increasing basis dimension

2012-02-14 Thread Simon Wood
Hi Greg, Recent mgcv versions use extended quasi-likelihood in place of the likelihood for (Laplace approx) REML with quasi families (e.g. McCullagh and Nelder, GLM book 2nd ed section 9.6): this fixes the problems with trying to use the quasi-likelihood directly with REML. best, Simon On

[R] cross validation in rvm not working? (kernlab package)

2012-02-14 Thread Martin Batholdy
Hi, according to ?rvm the relevance vector machine function as implemented in the kernlab-package has an argument 'cross' with which you can perform k-fold cross validation. However, when I try to add a 10-fold cross validation I get the following error message: Error in match.arg(type,

Re: [R] sequencing environments

2012-02-14 Thread Duncan Murdoch
On 12-02-14 12:34 AM, Ben quant wrote: Hello, I can get at environments if I know their names, but what if want to look at what environments currently exist at some point in a script? In other words, if I don't know what environments exist and I don't know their sequence/hierarchy, how do I

Re: [R] comment lines sometimes removed from a function on exit from internal R editor

2012-02-14 Thread Duncan Murdoch
On 12-02-13 6:02 PM, Cleridy Lennert wrote: Dear All - The problem: comment lines in an R function (lines beginning with # ) are *sometimes* removed on leaving the R default editor (same with notepad). I'm working on a Windows machine with R version 2.14.1. An example is below. Couldn't find

Re: [R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-14 Thread R. Michael Weylandt
Yes, I just checked out the bootstrap package: the problem is that it passes vectors (not matrices) to your function and thats why you get the error you do. Just use diff() instead of apply(,, diff) in your function and you'll be fine. Michael On Mon, Feb 13, 2012 at 12:48 PM, hithit168

Re: [R] nice report generator?

2012-02-14 Thread Duncan Murdoch
On 12-02-13 2:27 PM, Duncan Murdoch wrote: On 06/02/2012 4:12 PM, Hadley Wickham wrote: 2. It's more flexible to construct the language object as a language object, rather than pasting something together and parsing it. For one thing, that allows non-syntactic variable names; I think

[R] save objects of own function to workspace

2012-02-14 Thread Marion Wenty
Dear R-helpers, I created an own function which looks like this s_elternmz - function(Var=balt) { Dg_a-mz[,c(asbhh,apkz,Var)] colnames(Dg_a)[colnames(Dg_a)==apkz]-bpkzm colnames(Dg_a)[colnames(Dg_a)==Var]-paste(Var,_m,sep=) mz_int-merge(mz,Dg_a,by=c(asbhh,bpkzm),all.x=T)

Re: [R] Two surfaces in one plot with visibility

2012-02-14 Thread Michael Friendly
On 2/13/2012 11:15 AM, Duncan Murdoch wrote: On 13/02/2012 9:24 AM, Sebastian Schubert wrote: Hi, I would like plot two surfaces which are each given by vectors x and y, and a matrix m(x,y) representing the z coordinate. With persp() I can plot both, using par(new=TRUE) I can put it in one

Re: [R] mgcv: increasing basis dimension

2012-02-14 Thread Greg Dropkin
thanks Simon I'll upgrade R to try t2. The data I'm actually analysing requires scaled Poisson so I don't think REML is an option. thanks Greg On 14/02/12 11:22 Simon Wood wrote: That's interesting. Playing with the example, it doesn't seem to be a local minimum. I think that this happens

[R] save output of loop

2012-02-14 Thread uday
I have some data files e.g 100 . and after for loop I would like to save all data in one single data frame file_s - list.files(path = ., pattern = v2.0.2.txt, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) for (i in 1:100){

[R] Calculate mean between to classes for each ID

2012-02-14 Thread Sana
I have a data set that looks like this: ID STRATA G_F_Bl Dkl N g_pr_dklN_haG_ha 20,103 2 1 5 5 0,002 250 0,5 20,103 2 1 7 3 0,0038 150 0,57 20,103 2 1 9 6 0,0064 300 1,92 20,103

[R] testing for a distribution of probability

2012-02-14 Thread Bianca A Santini
Hello! I have several variables. Each of them has a different distribution. I was thinking to use a Generalized Linear Model, glm(), but I need to introduce the family. Do you know if R has any tests for matching data to any distribution ( I am aware of shapiro.test). All the best, -- BAS

[R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread ATANU
I am using R 2.14.1. I am trying to configure Lyx with Sweave. I have read articles but I found none to be complete and I cannot import sweave document in lyx . Can anyone please help me with a stepwise procedure how to configure Lyx with Sweave so that I can run my R-code chunks from LYX ,the

[R] Selecting elements from all items in a list

2012-02-14 Thread geotheory
Basic question (if you know the answer)... I am dealing with a list of commonly-formatted sub-lists, for example: l - list() l[[1]] - c(A1,A2,A3) l[[2]] - c(B1,B2,B3) l[[3]] - c(C1,B2,B3) Lets say I need to extract every 2nd item (i.e. A2, B2, C2). [[]] cannot be used. l[2] returns

Re: [R] Two surfaces in one plot with visibility

2012-02-14 Thread Duncan Murdoch
On 14/02/2012 9:19 AM, Michael Friendly wrote: On 2/13/2012 11:15 AM, Duncan Murdoch wrote: On 13/02/2012 9:24 AM, Sebastian Schubert wrote: Hi, I would like plot two surfaces which are each given by vectors x and y, and a matrix m(x,y) representing the z coordinate. With persp() I can

Re: [R] save objects of own function to workspace

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 9:20 AM, Marion Wenty wrote: Dear R-helpers, I created an own function which looks like this s_elternmz - function(Var=balt) { Dg_a-mz[,c(asbhh,apkz,Var)] colnames(Dg_a)[colnames(Dg_a)==apkz]-bpkzm colnames(Dg_a)[colnames(Dg_a)==Var]-paste(Var,_m,sep=)

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread Duncan Murdoch
On 14/02/2012 7:41 AM, ATANU wrote: I am using R 2.14.1. I am trying to configure Lyx with Sweave. I have read articles but I found none to be complete and I cannot import sweave document in lyx . Can anyone please help me with a stepwise procedure how to configure Lyx with Sweave so that I can

Re: [R] Selecting elements from all items in a list

2012-02-14 Thread Dimitris Rizopoulos
How about: l - list() l[[1]] - c(A1,A2,A3) l[[2]] - c(B1,B2,B3) l[[3]] - c(C1,B2,B3) lapply(l, [[, 2) or sapply(l, [[, 2) I hope it helps. Best, Dimitris On 2/14/2012 2:44 PM, geotheory wrote: Basic question (if you know the answer)... I am dealing with a list of commonly-formatted

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 14/02/12 13:41, ATANU wrote: I am using R 2.14.1. I am trying to configure Lyx with Sweave. I have read articles but I found none to be complete and I cannot import sweave document in lyx . Can anyone please help me with a stepwise

[R] Wildcard for indexing?

2012-02-14 Thread Johannes Radinger
Hi, I'd like to know if it is possible to use wildcards * for indexing... E.g. I have a vector of strings. Now I'd like to select all elements which start with A_*? I'd also need to combine that with logical operators: Select all elements of a vector that start with A (A*) OR that start with B

Re: [R] Selecting elements from all items in a list

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 8:44 AM, geotheory wrote: Basic question (if you know the answer)... I am dealing with a list of commonly-formatted sub-lists, for example: l - list() l[[1]] - c(A1,A2,A3) l[[2]] - c(B1,B2,B3) l[[3]] - c(C1,B2,B3) Lets say I need to extract every 2nd item (i.e. A2, B2,

Re: [R] Wildcard for indexing?

2012-02-14 Thread Duncan Murdoch
On 14/02/2012 9:54 AM, Johannes Radinger wrote: Hi, I'd like to know if it is possible to use wildcards * for indexing... E.g. I have a vector of strings. Now I'd like to select all elements which start with A_*? I'd also need to combine that with logical operators: Select all elements of a

Re: [R] Wildcard for indexing?

2012-02-14 Thread R. Michael Weylandt
I think the grep()-family (regular expressions) will be the easiest way to do this, though it sounds like you might prefer grepl() which returns a logical vector: ^[AB] # Starts with either an A or a B ^A_ # Starting with A_ a - c(A_A,A_B,C_A,BB,A_Asd grepl(^[AB], a) grepl(^A_) Michael On

Re: [R] Wildcard for indexing?

2012-02-14 Thread Sarah Goslee
Hi, On Tue, Feb 14, 2012 at 9:54 AM, Johannes Radinger jradin...@gmx.at wrote: Hi, I'd like to know if it is possible to use wildcards * for indexing... E.g. I have a vector of strings. Now I'd like to select all elements which start with A_*? I'd also need to combine that with logical

Re: [R] save output of loop

2012-02-14 Thread jim holtman
try this: file_s - list.files(path = ., pattern = v2.0.2.txt, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) result - do.call(rbind, lapply(file_s, function(.file){ data - read.table(.file, header=TRUE) data.frame(lat =

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 9:44 AM, Duncan Murdoch wrote: On 14/02/2012 7:41 AM, ATANU wrote: I am using R 2.14.1. I am trying to configure Lyx with Sweave. I have read articles but I found none to be complete and I cannot import sweave document in lyx . Can anyone please help me with a stepwise

[R] fit data to y~A+B*sin(C*x)

2012-02-14 Thread Jonas Stein
I want to fit discrete data that was measured on a wavegenerator. In this minimal example i generate some artificial data: testsin - 2+ 5 * sin(1:100) #generate sin data testsin - testsin+ rnorm(length(testsin), sd = 0.01) #add noise mydata - list(X=1:100, Y=testsin) # generate mydata object

Re: [R] passing an extra argument to an S3 generic

2012-02-14 Thread Michael Friendly
On 2/11/2012 12:00 PM, ilai wrote: You are setting a new class (inflmlm) at the end of mlm.influence. Remove that second to last line and enjoy your new S3 method. Thanks for the suggestion, but it doesn't help -- I still get the same behavior whether mlm.influence returns a classed object or

Re: [R] Wildcard for indexing?

2012-02-14 Thread Johannes Radinger
Hi, Original-Nachricht Datum: Tue, 14 Feb 2012 09:59:39 -0500 Von: R. Michael Weylandt michael.weyla...@gmail.com An: Johannes Radinger jradin...@gmx.at CC: R-help@r-project.org Betreff: Re: [R] Wildcard for indexing? I think the grep()-family (regular expressions) will

Re: [R] fit data to y~A+B*sin(C*x)

2012-02-14 Thread Sarah Goslee
Hi Jonas, I'm afraid we need more detail. On Mon, Feb 13, 2012 at 5:54 PM, Jonas Stein n...@jonasstein.de wrote: I want to fit discrete data that was measured on a wavegenerator. In this minimal example i generate some artificial data: testsin - 2+ 5 * sin(1:100) #generate sin data testsin

Re: [R] Wildcard for indexing?

2012-02-14 Thread Sarah Goslee
Hi, You should probably do a bit of reading about regular expressions, but here's one way: On Tue, Feb 14, 2012 at 10:10 AM, Johannes Radinger jradin...@gmx.at wrote: Hi, Original-Nachricht Datum: Tue, 14 Feb 2012 09:59:39 -0500 Von: R. Michael Weylandt

Re: [R] fit data to y~A+B*sin(C*x)

2012-02-14 Thread David L Carlson
Don't you want to predict testsin (aka Y) from X? nlmod - nls(Y ~ A+B*sin(C* X), data=mydata, start=list(A=2, B=4, C=1), trace=TRUE) 50.42965 : 2 4 1 0.007393982 : 1.9989006 5.0014997 0.902 0.007377637 : 1.9989005 5.0015002 0.922 0.007377637 : 1.9989005 5.0015002 0.922

Re: [R] Wildcard for indexing?

2012-02-14 Thread Duncan Murdoch
On 14/02/2012 10:10 AM, Johannes Radinger wrote: Hi, Original-Nachricht Datum: Tue, 14 Feb 2012 09:59:39 -0500 Von: R. Michael Weylandtmichael.weyla...@gmail.com An: Johannes Radingerjradin...@gmx.at CC: R-help@r-project.org Betreff: Re: [R] Wildcard for indexing?

Re: [R] Wildcard for indexing?

2012-02-14 Thread Johannes Radinger
Original-Nachricht Datum: Tue, 14 Feb 2012 10:18:33 -0500 Von: Sarah Goslee sarah.gos...@gmail.com An: Johannes Radinger jradin...@gmx.at CC: R-help@r-project.org Betreff: Re: [R] Wildcard for indexing? Hi, You should probably do a bit of reading about regular

Re: [R] fit data to y~A+B*sin(C*x)

2012-02-14 Thread Berend Hasselman
On 13-02-2012, at 23:54, Jonas Stein wrote: I want to fit discrete data that was measured on a wavegenerator. In this minimal example i generate some artificial data: testsin - 2+ 5 * sin(1:100) #generate sin data testsin - testsin+ rnorm(length(testsin), sd = 0.01) #add noise mydata -

Re: [R] fit data to y~A+B*sin(C*x)

2012-02-14 Thread Bert Gunter
Note that, given C, A and B can be obtained by simple linear regression of y on sin(Cx). Hence you could avoid nls altogether by a simple search of the minimal ls solution(possibly robust) over a grid of C values. Or do this to find good starting values for nls. Bert Sent from my iPhone --

Re: [R] save objects of own function to workspace

2012-02-14 Thread Marion Wenty
Thank you very much for your help, David! Now I have got an object which I can work with. You mentioned that I took two steps to create the new column names. I had tried doing it in one step but couldn't find out how. Could you help me with that, as well? Thank you very much! Marion

Re: [R] save objects of own function to workspace

2012-02-14 Thread Jeff Newmiller
It is possible to do what you ask using - instead of -, but from the perspective of using the function it will be much clearer if you add mz as an argument to the function along with Var, and return mz_int at the end. (The easiest way to return a variable is to type it alone on the last line if

Re: [R] Writing R-scripts

2012-02-14 Thread Cem Girit
Hello Jim, Thank you. This will really help me to get the result I need. But I am having an error message when I run the code although testtype is set to 2 in the calling function to run the Dunnet test. What am I doing wrong? pt-parametric.tests(testtype=2, resp, groups,

Re: [R] passing an extra argument to an S3 generic

2012-02-14 Thread ilai
Hi Michael, Try the attached. The only change to your script is in the first line where I explicitly tell hatvalues to use methods (the infmlm class stays). I also commented out all your TESTME at the end. source('mlminfl-testHELP.R') Now this should have worked for you too. Let me know. Sorry

[R] cumsum function to determine plankton phenology

2012-02-14 Thread Heather Anne Wright
Apologies for the empty email earlier! I have species abundance data sampled at a weekly frequency or sometimes monthly depending on the year. The goal is to identify the dates in an annual cycle in which the cumulative abundance of a species reaches some threshold. Here's an example of the data

Re: [R] Selecting elements from all items in a list

2012-02-14 Thread geotheory
Yes the lapply function sorted it out. Thanks for the advice. -- View this message in context: http://r.789695.n4.nabble.com/Selecting-elements-from-all-items-in-a-list-tp4387045p4387505.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] save output of loop

2012-02-14 Thread johnmark
The short answer to your question is *don't* concatenate the values in the row, then attempt to /rbind()/ them incrementally to a data.frame. Instead build each column separately inside the loop, then /cbind() (data.frame()/ does an implicit/ cbind()/ ) them together at the end. Something like

Re: [R] cross validation in rvm not working? (kernlab package)

2012-02-14 Thread Uwe Ligges
Please report bugs in packages to the corresponding package maintainer (perhaps suggesting a fix if you have an idea how to do that). Uwe Ligges On 14.02.2012 12:42, Martin Batholdy wrote: Hi, according to ?rvm the relevance vector machine function as implemented in the kernlab-package has

Re: [R] If (x 0)

2012-02-14 Thread ilai
On Tue, Feb 14, 2012 at 6:41 AM, Schmidt, Michael mschm...@med.miami.edu wrote: So the function must come BEFORE the call to the function...I see. Yes. May be different than what you're used to but in R think of functions as just another set of objects. Therefore they must be declared in the

[R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread Jun Shen
Dear all, In a plot command like xyplot(Y~X|ID*PERIOD,data=...) xyplot will generate all the possible ID*PERIOD combinations. But not all of them have data in there. So I have a lot of empty plots. How can I suppress those empty plots and ask xyplot only to generate plots actually with data.

[R] Access to OpenBLAS

2012-02-14 Thread Scott Raynaud
My IT people have set up a Kubuntu box with an RWkard front end.  I have OpenBLAS set up as a shared BLAS but I'm not sure how to get R to see it.  A.3.1 of the installation docs talks about it but I'm not clear if I need a option on my startup line or if I need to find a config file.  The BLAS is

Re: [R] cumsum function to determine plankton phenology

2012-02-14 Thread David L Carlson
Is it necessary to match the Excel results? If not, you could just use approx or approxfun to do a linear interpolation of the cumulative sums at each of the three points. It would be simpler, faster, and easier to understand. Taking mean(.15-datayear$cumsum) is giving you the mean of all the

Re: [R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread Jeff Newmiller
Set up a single (factor) variable that identifies the combinations that exist, and plot using that variable. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.us

Re: [R] Access to OpenBLAS

2012-02-14 Thread Prof Brian Ripley
On 14/02/2012 17:01, Scott Raynaud wrote: My IT people have set up a Kubuntu box with an RWkard front end. I have OpenBLAS set up as a shared BLAS but I'm not sure how to get R to see it. A.3.1 of the installation docs talks about it but I'm not clear if I need a option on my startup line or

Re: [R] Access to OpenBLAS

2012-02-14 Thread Dirk Eddelbuettel
On 14 February 2012 at 09:01, Scott Raynaud wrote: | My IT people have set up a Kubuntu box with an RWkard front | end.  I have OpenBLAS set up as a shared BLAS but I'm not | sure how to get R to see it.  A.3.1 of the installation docs talks | about it but I'm not clear if I need a option on my

Re: [R] save objects of own function to workspace

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 10:59 AM, Marion Wenty wrote: Thank you very much for your help, David! Now I have got an object which I can work with. You mentioned that I took two steps to create the new column names. I had tried doing it in one step but couldn't find out how. Could you help me with

Re: [R] Writing R-scripts

2012-02-14 Thread Jeff Newmiller
A) You should (re)read the posting guidelines, and pay particular attention to supplying reproducible examples. (Not your whole script.. just a cut down version that others can run that exhibits the problem.) B) Perhaps you should reconsider the task you have set yourself. You seem to be

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread Jeff Laake
On 2/14/2012 6:51 AM, Rainer M Krug wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 14/02/12 13:41, ATANU wrote: I am using R 2.14.1. I am trying to configure Lyx with Sweave. I have read articles but I found none to be complete and I cannot import sweave document in lyx . Can anyone

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread Yihui Xie
The only (yes, only) documentation you should look at now is the official manual of Sweave in LyX, which you can find under the examples directory of your LyX installation for LyX 2.0.2; it will appear under the Help menu after LyX 2.0.3 (not released yet, but will be soon). If you are still

Re: [R] configure lyx2.0.2 with sweave in windows 32 bit.

2012-02-14 Thread Yihui Xie
I just looked at Jeff's tutorials; they are great! I no longer see instructions on noweb or Sweave.sty, so I highly recommend them as well. I will add links in the official manual. Thanks, Jeff! Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department

Re: [R] different way for a for loop for several columns?

2012-02-14 Thread ilai
Inline On Tue, Feb 14, 2012 at 3:16 AM, Nerak T nera...@hotmail.com wrote: Dear Ilai, Thanks for your answer. I'm indeed kind of a beginner in R, starting to discover the endless possibilities in R. My goal for the moment is indeed to get rid of the use of loops and to see through the

Re: [R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread Jun Shen
Thanks, Jeff, It did work in one way if I use xyplot(Y~X|as.factor(ID*PERIOD),data=...) But I would like to do something like xyplot(Y~X|as.factor(paste(ID=,ID)*paste(PERIOD=,PERIOD)),data=...) Then, it didn't work The error message: Error in paste(ID=, ID) * paste(PERIOD=, PERIOD) :

[R] sequential sum

2012-02-14 Thread baccts
Dear R users, I am trying to sum number that exist in another vector up to i, then increment i and repeat. Sorry. It's hard to explain but basically I am trying to do the following: test - c(1,2,3,4); test2 - c(3,5,6,7,2,8,8,4,4); test3 - c(10,20,30,40); tmp - 0; for (i in 1:length(test)){ tmp[i]

[R] Plotting function image

2012-02-14 Thread uday
I have some data set which has latitude, longitude and Z values. I would like to plot them on global map. I am thinking to use image image(x, y, z, zlim, xlim, ylim, col = heat.colors(12), add = FALSE, xaxs = i, yaxs = i, xlab, ylab, breaks, oldstyle = FALSE, useRaster = FALSE, ...)

Re: [R] save output of loop

2012-02-14 Thread uday
Hi it works fine thanks -- View this message in context: http://r.789695.n4.nabble.com/save-output-of-loop-tp4386599p4387806.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] save output of loop

2012-02-14 Thread uday
The dimensions of variables are unknown , they changes to every file. -- View this message in context: http://r.789695.n4.nabble.com/save-output-of-loop-tp4386599p4387804.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread Bert Gunter
What do you think A * B means? Why? Have you read R's Introduction manual? -- Bert On Tue, Feb 14, 2012 at 9:50 AM, Jun Shen jun.shen...@gmail.com wrote: Thanks, Jeff, It did work in one way if I use xyplot(Y~X|as.factor(ID*PERIOD),data=...) But I would like to do something like

Re: [R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread ilai
read ?xyplot It takes a skip argument:          ‘skip’: logical vector (default ‘FALSE’), replicated to be as              long as the number of panels (spanning all pages).  For              elements that are ‘TRUE’, the corresponding panel              position is skipped; i.e., nothing is

[R] weights in glm() of logistic regression when response is proportion

2012-02-14 Thread Yinyan Guo
Dear R-list members, I would like to pose a question about the use of the glm() function for logistic regression when response is proportion range 0.0-1.0. When logistic regression in glm (y proportion response) is used as: disease.logr - glm(y ~ x, weights = ntrial, family=binomial, ...) My

Re: [R] finding the subscript of a vector fulfiiling a given condition

2012-02-14 Thread Pete Brecknock
galemago wrote Dear Forum, I just recently started to work with R, I´d like to know if there is a way to give instructions/do operations related to values with different subscripts within a vector. Let´s assume I have a vector like this: A=368369370371 393394395

Re: [R] sequential sum

2012-02-14 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of baccts Sent: Tuesday, February 14, 2012 9:04 AM To: r-help@r-project.org Subject: [R] sequential sum Dear R users, I am trying to sum number that exist in another vector up

[R] svm with GRASS GIS

2012-02-14 Thread gab
Dear R Community- I am a new user of R. I am using R with GRASS GIS. I would apply svm on raster data in GRASS. Basically I have a raster with areas training and other three raster (each represents a band of ASTER satellite image). My goal is to classify, according to training areas, the 3

[R] execute array of functions

2012-02-14 Thread Muhammad Rahiz
Hi all, I'm trying to get the min and max of a sequence of number using a loop like the folllowing. Can anyone point me to why it doesn't work. Thanks. type- c(min,max) n - 1:10 for (a in 1:2){ print(type[a](n)) } -- Muhammad __

Re: [R] Calculate mean between to classes for each ID

2012-02-14 Thread Patrick Connolly
On Tue, 14-Feb-2012 at 04:30AM -0800, Sana wrote: | I have a data set that looks like this: | ID STRATA G_F_Bl Dkl N g_pr_dklN_haG_ha | 20,103 2 1 5 5 0,002 250 0,5 | 20,103 2 1 7 3 0,0038 150 0,57 |

Re: [R] execute array of functions

2012-02-14 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Muhammad Rahiz Sent: Tuesday, February 14, 2012 11:03 AM To: x.r-help Subject: [R] execute array of functions Hi all, I'm trying to get the min and max of a sequence of

Re: [R] sequential sum

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 1:38 PM, Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of baccts Sent: Tuesday, February 14, 2012 9:04 AM To: r-help@r-project.org Subject: [R] sequential sum Dear R users, I

Re: [R] execute array of functions

2012-02-14 Thread Stavros Macrakis
That won't work because R has special rules for evaluating things in the function position. Examples: *OK* min(1:2) min(1:2) f-min; f(1:2) do.call(min,list(1:2)) do.call(min,list(1:2)) # do.call converts string-function *Not OK* (min)(1:2) # string in function position is

Re: [R] execute array of functions

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 2:23 PM, Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Muhammad Rahiz Sent: Tuesday, February 14, 2012 11:03 AM To: x.r-help Subject: [R] execute array of functions Hi all,

[R] Creating categories from a date-time object

2012-02-14 Thread Jose Bustos Melo
Hello R-List, I have a question about recoding from a date time object.  I have tried using as.POSIXct objects and Chron Objects, but I can get the what I want. I need to create a new variable from a date-time object, adding Office Time for those events that happens between 08:00:00 to

Re: [R] execute array of functions

2012-02-14 Thread David Winsemius
On Feb 14, 2012, at 2:32 PM, Stavros Macrakis wrote: That won't work because R has special rules for evaluating things in the function position. Examples: *OK* min(1:2) min(1:2) f-min; f(1:2) do.call(min,list(1:2)) do.call(min,list(1:2)) # do.call converts string-function *Not OK*

Re: [R] execute array of functions

2012-02-14 Thread Duncan Murdoch
On 14/02/2012 2:23 PM, Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Muhammad Rahiz Sent: Tuesday, February 14, 2012 11:03 AM To: x.r-help Subject: [R] execute array of functions Hi

Re: [R] execute array of functions

2012-02-14 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Nordlund, Dan (DSHS/RDA) Sent: Tuesday, February 14, 2012 11:24 AM To: r-help@r-project.org Subject: Re: [R] execute array of functions -Original Message- From:

Re: [R] execute array of functions

2012-02-14 Thread Bert Gunter
Not sure the replies you received make it clear, but the key point is that functions are first class objects in R like any other objects (vectors, lists, data frames) and can be assigned, collected into structures, indexed, etc. in the usual way. Further, if the value of any R expression is a

[R] Strange plotting error

2012-02-14 Thread Diviya Smith
Hi there, I am trying to compute the autocorrelation in a dataset using R's acf function. ACF automatically plots the results. This works well except in some cases xlim doesnt work data - rnorm(2000,0,1) acf(data,xlim=c(1,10)) # works - the plot starts at 1 acf(data,lag=100,xlim=c(1,100)) #

Re: [R] best subset selection on random effects model

2012-02-14 Thread ilai
I don't know of any package that will do it (or if violating the marginality principle by having non-nested models even makes sense) but you could always build your own search through all possible models. Problem is for a large number of fixed effects this can take a good bit of time... Here is a

[R] txtStart creates a NULL file

2012-02-14 Thread Simon Kiss
Hello all: I'm trying to use the following code to get commands, comments and results to a .txt file. It only appears to capture comments. When I comment those out with #, it creates a NULL file. Someone seemed to have a similar problem with a mac GUI

Re: [R] hexplom question(s)

2012-02-14 Thread Greg Snow
Assuming this is the hexplom function from the hexbin package (it is best to be specific in case there are multiple versions of the function you ask about), you can specify lower.panel=function(...){} for a, and as.matrix=TRUE for c, for b I am not sure what exactly you want to do, but look at the

[R] Spline Question

2012-02-14 Thread Hasan Diwan
dput(sensor.sample) structure(c(1328565718.65, 1328566608.9, 1328566162.65, 1328566571.1, 1328566598.85, 1328565634.3, 1328566513.95, 1328565123.65, 1328565827.1, 1328566719.9, 1328565527.55, 1328565118.05, 1328565556.85, 1328565623.85, 1328565230.75, 1328566083.85, 1328566012.45, 1328566795.75,

[R] Filling out a data frame row by row.... slow!

2012-02-14 Thread Peter Meilstrup
I'm reading a file and using the file to populate a data frame. The way the file is laid out, I need to fill in the data frame one row at a time. When I start reading my file, I don't know how many rows I will need. It's on the order of a million. Being mindful of the time expense of

Re: [R] Strange plotting error

2012-02-14 Thread Duncan Murdoch
On 12-02-14 3:13 PM, Diviya Smith wrote: Hi there, I am trying to compute the autocorrelation in a dataset using R's acf function. ACF automatically plots the results. This works well except in some cases xlim doesnt work data- rnorm(2000,0,1) acf(data,xlim=c(1,10)) # works - the plot starts

Re: [R] sequential sum

2012-02-14 Thread C Lin
Dan, Thank you very much. That is exactly what I need. What a clever solution. David, thanks for trying. Thank you all. I would never be able to figure it out on my own. Lin From: dwinsem...@comcast.net To: nord...@dshs.wa.gov Date: Tue, 14 Feb 2012 14:28:21 -0500 CC:

[R] Color cells of a matrix as in Excel

2012-02-14 Thread John Nicholas
All, I frequently make spreadsheets in Excel in which I rank values in columns by stop-light colors (red is bad, yellow is OK, green is good). Image and heatmap expect a matrix in which all the data are in the same scale, but I frequently have different scales in different columns. ie. Column

Re: [R] Filling out a data frame row by row.... slow!

2012-02-14 Thread William Dunlap
If you must repeatedly append rows to a data.frame, try making the dataset you are filling in a bunch of independent vectors, perhaps in a new environment to keep things organized, and expand each at the same time. At the very end make a data.frame out of those vectors. E.g., change the likes of

Re: [R] Color cells of a matrix as in Excel

2012-02-14 Thread Kenneth Frost
Hi, John- Would it be possible to scale the values in each column to fall between 0 and 1 (or standardize them) and use a single color ramp? Ken On 02/14/12, John Nicholas wrote: All, I frequently make spreadsheets in Excel in which I rank values in columns by stop-light colors (red is

  1   2   >