[R] NaN as a parameter in NLMINB optimization

2007-12-20 Thread Rebecca Sela
I am trying to optimize a likelihood function using NLMINB. After running without a problem for quite a few iterations (enough that my intermediate output extends further than I can scroll back), it tries a vector of parameter values NaN. This has happened with multiple Monte Carlo datasets, a

Re: [R] using apply to loop

2007-12-20 Thread Tyler Smith
On 2007-12-21, Louis Martin <[EMAIL PROTECTED]> wrote: > Hi, > > I am running the following loop, but it takes hours to run as n is big. Is > there any way "apply" can be used? Thanks. > ### Start > nclass <- dim(data)[[2]] - 1 > z <- matrix(0, ncol = nclass, nrow = nclass) > n <- dim(

Re: [R] using apply to loop [SEC=UNCLASSIFIED]

2007-12-20 Thread Crombie, Joe
Hi Louis, You could try this: # find the index of the maximum value in each row of _data_, # disregarding the last column classified <- apply(data[,-(nclass+1)],1,which.max) ## or, if the maximum may be repeated: classified <- apply(data[,-(nclass+1)], 1, FUN = function(x) which(x == max(x))) #

Re: [R] ifelse problem

2007-12-20 Thread Charilaos Skiadas
To check for NA, use is.na. For instance your second ifelse should read: ifelse(is.na(Sheet1$Claims),0,Sheet1$Claims)) Converting Sheet1$Claims to character doesn't have the effect you think it does. NA is still NA, it does not become "NA". Try for instance: as.character(NA) as.character(NA)

[R] using apply to loop

2007-12-20 Thread Louis Martin
Hi, I am running the following loop, but it takes hours to run as n is big. Is there any way "apply" can be used? Thanks. ### Start nclass <- dim(data)[[2]] - 1 z <- matrix(0, ncol = nclass, nrow = nclass) n <- dim(data)[[1]] x <- c(1:nclass) # loop starts for(loop in 1:n) {

[R] predicted mle() values.

2007-12-20 Thread Milton Cezar Ribeiro
Dear all, I am comparing two regression models, one by nls() and other by mle() packages. I know how do plot the estimated values using curve() function, but I need the predicted to use on other functions and I don´t know how do get the predicted value my mle model. Any help are welcome. mil

Re: [R] alternate storage options

2007-12-20 Thread Moshe Olshansky
You can use a loop... If x,y and z are your vectors containing Nx,Ny and Nz numbers respectively, then for (Ix in 1:Nx) for (Iy in 1:Ny) for (Iz in 1:Nz) { Point <- c(x[Ix],y[Iy],z[Iz]) do whatever you need with Point } A (probably better) compromise may be: a <- matrix(0,nrow = Ny*Nz, ncol = 3)

[R] ifelse problem

2007-12-20 Thread Randy Walters
Could someone help me with the following code snippet. The results are not what I expect: > Sheet1$Claims[1:10] [1] NA 1 2 NA NA NA NA NA NA NA > Sheet1[1:10,"SubmissionStatus"] [1] Declined Bound Bound Bound Bound Bound Declined Dead Declined [10] Not Taken Leve

[R] package clim.pact

2007-12-20 Thread Maura E Monville
I would like to try the SSA approach with my data. If i am not mistaken there is a package named "clim.pact" in the R repository that does that. I tried to download on my Linux box and it failed as it cannot resolve a dependency that is only needed for Windows platform (that is written in the site

Re: [R] randomForest() for regression produces offset predictions

2007-12-20 Thread David Katz
I would expect this regression towards the mean behavior on a new or hold out dataset, not on the training data. In RF terminology, this means that the model prediction from predict is the in-bag estimate, but the out-of-bag estimate is what you want for prediction. In Joshua's example, rf.rf$pred

Re: [R] Efficient way to find consecutive integers in vector?

2007-12-20 Thread Johannes Graumann
Thanks for your Inputs! Joh Johannes Graumann wrote: > Hi all, > > Does anybody have a magic trick handy to isolate directly consecutive > integers from something like this: > c(1,2,3,4,7,8,9,10,12,13) > > The result should be, that groups 1-4, 7-10 and 12-13 are consecutive > integers ... >

Re: [R] Calculate remainer

2007-12-20 Thread Moshe Olshansky
This is OK if the ratio is positive, but for -50 divided by 12 the floor is -5 and the remainder is 10 (and not -4 and -2 as one may want). By the way, using %% and %/% leads to same result. Using trunc will remedy the situation, i.e. > x <- -50 > y <- 12 > a <- trunc(x/y) > r <- x - a*y > a [1] -

Re: [R] Quote: An embedded and charset-unspecified text was scrubbed...

2007-12-20 Thread Talbot Katz
Duncan, thank you for the suggestion. This should be a plain text message, perhaps it will post correctly to the R-help Archives. -- TMK -- 212-460-5430home 917-656-5351cell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] Quote: An embedded and charset-unspecified text was scrubbed...

2007-12-20 Thread Duncan Murdoch
On 20/12/2007 5:46 PM, Talbot Katz wrote: > Hi Duncan. Thank you for responding. Here is the URL in the R-help Archives > for the original message I posted in this thread: > > https://stat.ethz.ch/pipermail/r-help/2007-December/148923.html > > When I go to that page, I see the scrub message.

Re: [R] comparing poisson distributions

2007-12-20 Thread Rolf Turner
On 21/12/2007, at 10:53 AM, Greg Snow wrote: > > 5.2 if this is just to make someone happy who always wants a p-value, > but doesn't understand it and will never actually use it, then use > runif. A fortune? cheers, Rolf Turner #

Re: [R] Quote: An embedded and charset-unspecified text was scrubbed...

2007-12-20 Thread Talbot Katz
Hi Duncan. Thank you for responding. Here is the URL in the R-help Archives for the original message I posted in this thread: https://stat.ethz.ch/pipermail/r-help/2007-December/148923.html When I go to that page, I see the scrub message. I can read your response at: https://stat.ethz.ch/

Re: [R] can optimize solve paired euqations?

2007-12-20 Thread Ravi Varadhan
Hi Xin, You can use the nlsolve() function that I have written to solve a nonlinear system of equations. It converts a root finding problem into a minimization problem, and uses optim() to find the minimizer. A well-known problem with this approach to root-finding is that a local minimum of th

Re: [R] collapsing a list in a var.

2007-12-20 Thread jim holtman
> my.obj<-c("a1","a2","a3") > paste(my.obj, collapse=" ") [1] "a1 a2 a3" On Dec 20, 2007 5:15 PM, Milton Cezar Ribeiro <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a object like my.obj<-c("a1","a2","a3") and I would like > my.new.obj="a1 a2 a3". > I tryed to do my.new.obj<-paste(my.obj,sep=

Re: [R] Efficient way to find consecutive integers in vector?

2007-12-20 Thread Marc Schwartz
On Thu, 2007-12-20 at 22:43 +0100, Johannes Graumann wrote: > Hi all, > > Does anybody have a magic trick handy to isolate directly consecutive > integers from something like this: > c(1,2,3,4,7,8,9,10,12,13) > > The result should be, that groups 1-4, 7-10 and 12-13 are consecutive > integers ..

Re: [R] collapsing a list in a var.

2007-12-20 Thread Peter Alspach
?sep paste(my.obj, collapse=" ") HTH .. Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Milton > Cezar Ribeiro > Sent: Friday, 21 December 2007 11:15 a.m. > To: R-help > Subject: [R] collapsing a list in a var. > > Dear all,

[R] collapsing a list in a var.

2007-12-20 Thread Milton Cezar Ribeiro
Dear all, I have a object like my.obj<-c("a1","a2","a3") and I would like my.new.obj="a1 a2 a3". I tryed to do my.new.obj<-paste(my.obj,sep=" ") but it return three entries and I need only one entry as result. Any idea? Miltinho Brazil. para armazenamento! [[alternative HTML versi

Re: [R] Efficient way to find consecutive integers in vector?

2007-12-20 Thread Gabor Csardi
Joh, x <- c(1,2,3,4,7,8,9,10,12,13) which(diff(x) != 1) gives the indices of the 'jumps'. Gabor On Thu, Dec 20, 2007 at 10:43:05PM +0100, Johannes Graumann wrote: > Hi all, > > Does anybody have a magic trick handy to isolate directly consecutive > integers from something like this: > c(1,2,3,

[R] Efficient way to find consecutive integers in vector?

2007-12-20 Thread Johannes Graumann
Hi all, Does anybody have a magic trick handy to isolate directly consecutive integers from something like this: c(1,2,3,4,7,8,9,10,12,13) The result should be, that groups 1-4, 7-10 and 12-13 are consecutive integers ... Thanks for any hints, Joh __

Re: [R] comparing poisson distributions

2007-12-20 Thread Greg Snow
The other one I should have mentioned: 5.1: Use the glm function with family = poisson. The counts are the y variable and the x variable is either 0/1 or a 2 level factor indicating which group the values come from. The p-value for the slope of x tests for a difference in the 2 groups. 5.2 if

Re: [R] question

2007-12-20 Thread Greg Snow
?ifelse -- 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 Armelini, Guillermo > Sent: Wednesday, December 19, 2007 10:21 AM > To: [

Re: [R] Multiple plots with single box

2007-12-20 Thread Greg Snow
One possibility is to use the cnvrt.coords function from the TeachingDemos package. It shows an example of putting a rectangle across multiple plots. You would need to create the 1st (top) plot, find the coordinate of the top and convert that to device coordinates, then create the rest of your p

[R] running custom functions in Snow clusters

2007-12-20 Thread Michael Gormley
When running a function in parallel using for example the clusterCall function in Snow is it possible to call other user-written functions from each cluster? I get an error when I try to do this. I tried to source the function on each cluster using the clusterEvalQ function but this doesn't s

Re: [R] Quote: An embedded and charset-unspecified text was scrubbed...

2007-12-20 Thread Duncan Murdoch
On 20/12/2007 3:43 PM, Talbot Katz wrote: > Occasionally when I click on a posting in the archives, I don't see the > actual message, but instead, something like the following: > > An embedded and charset-unspecified text was scrubbed... > Name: not available > Url: > https://stat.ethz.ch/piper

Re: [R] assigning and saving datasets in a loop, with names changing with "i"

2007-12-20 Thread Greg Snow
Have you looked at the SQLiteDF package? It seems like it would do what you want in a better way and much simpler. Even if that does not work then a database approach (look at the other db packages, probably RODBC first) could be simpler, faster, and easier. You may also want to look at the g.da

Re: [R] Calculate remainer

2007-12-20 Thread Julian Burgos
Hi Livia, There are several ways to do this. Try: a=50/12 floor(a) will give you the entire portion, and a-floor(a) will give you the remainder. Julian livia wrote: > Hello everyone, > > I have got a question about a simple calculation. If I would like to > calculate 50/12 and return the re

[R] Quote: An embedded and charset-unspecified text was scrubbed...

2007-12-20 Thread Talbot Katz
Occasionally when I click on a posting in the archives, I don't see the actual message, but instead, something like the following: An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/200712XX/aXXX/attachment.pl

[R] smoothScatter and geneplotter

2007-12-20 Thread p_connolly
On Tue, 18-Dec-2007 at 11:21AM -0500, James W. MacDonald wrote: |> Duncan Murdoch wrote: |> > Yes, I agree. (As an aside, there's actually a capital S in |> > smoothScatter(), and it's a bit of a pain to install, because |> > geneplotter depends on something that depends on DBI, which is not so |

Re: [R] comparing poisson distributions

2007-12-20 Thread Greg Snow
There are a few different options that you can try depending on your problem and your preferences: 1. For large lambda the poisson can be approximated by a normal, for large n (even for small lambda) the mean is approximately normal due to the central limit theorem. So if your lambda and n are l

[R] Can't install RSPERL under windows

2007-12-20 Thread adiamond
I know that I'm a fool for trying to get this working under windows but I'm obliged. Note I have R 2.6.1 and the latest cygwin. I'm running winxp sp2. 1) If I issue: R CMD INSTALL RSPerl_0.92-1.tar.gz, it fails as such -- Making package RSPerl ***

Re: [R] randomForest() for regression produces offset predictions

2007-12-20 Thread Patrick Burns
What I see is the predictions being less extreme than the actual values -- predictions for large actual values are smaller than the actual, and predictions for small actual values are larger than the actual. That makes sense to me. The object is to maximize out-of-sample predictive power, not in-

Re: [R] Available environment variables

2007-12-20 Thread Duncan Murdoch
On 20/12/2007 2:13 PM, Thompson, David (MNR) wrote: > Hello, > > I am trying to set my environment to streamline the downloading / > updating of packages. I have been through R-intro.html (10.8 > Customizing-the-environment), R-FAQ (5.2 How can add-on packages be > installed?), rw-FAQ, and help pa

Re: [R] Question how to get up triangle of a matrix

2007-12-20 Thread markleeds
>From: Waverley <[EMAIL PROTECTED]> >Date: 2007/12/20 Thu PM 01:29:04 CST >To: [EMAIL PROTECTED] >Subject: [R] Question how to get up triangle of a matrix ?upper.tri >Is there a simple way to get up triangle of a matrix and return as a vector? > >Thanks much. > >-- >Waverley @ Palo Alto > >_

[R] Question how to get up triangle of a matrix

2007-12-20 Thread Waverley
Is there a simple way to get up triangle of a matrix and return as a vector? Thanks much. -- Waverley @ Palo Alto __ 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.o

[R] Data bug that read.csv doesn't like

2007-12-20 Thread Randall Johnson [Contr]
Hello, I have a bug in my data that read.csv doesn't like, but _only_ when specifying "na.strings = 'missing'". If I delete the offending Chinese characters the problem goes away as well. I'm satisfied that the problems with this data file are fixed, but is there anything I can to do avoid

[R] Available environment variables

2007-12-20 Thread Thompson, David (MNR)
Hello, I am trying to set my environment to streamline the downloading / updating of packages. I have been through R-intro.html (10.8 Customizing-the-environment), R-FAQ (5.2 How can add-on packages be installed?), rw-FAQ, and help pages for Sys.setenv {base}, download.packages {utils}, etc.,. I

Re: [R] Recursive solution with for()

2007-12-20 Thread Christos Hatzis
It not entirely clear, but I think that you are looking for seq(t-1, 1) -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Owe Jessen > Sent: Thursday, December 20, 2007 1:29 PM > To: [EMAIL PROTECTED] > Subject: [R] Recursive solution wit

[R] Recursive solution with for()

2007-12-20 Thread Owe Jessen
Hello, i just ran into the following problem: I wanted to recursively solve equations of the type x_1[t]=x_1[t+1]+beta*x_2[t], and used a for-loop written for(j in c(1:t-1, recursive=TRUE){ ... } This didn't work, so i resolved to writing for(j in c(10,9,...,1){ which worked, but is not terri

Re: [R] hierarchical linear models, mixed models and lme

2007-12-20 Thread Dieter Menne
Nicolas Ris sophia.inra.fr> writes: > I am trying to analyse the data of the box 10.5 in the Biometry from > Sokal and Rohlf (2001) using R. This is a three-level nested anova with > equal sample size : 3 different treatments are compared ; 2 rats (coded > 1 or 2) / treatment are studied ; 3 p

[R] hierarchical linear models, mixed models and lme

2007-12-20 Thread Nicolas Ris
Dear R-users, I am trying to analyse the data of the box 10.5 in the Biometry from Sokal and Rohlf (2001) using R. This is a three-level nested anova with equal sample size : 3 different treatments are compared ; 2 rats (coded 1 or 2) / treatment are studied ; 3 preparations (coded 1, 2 or 3) /

Re: [R] Question about which kind of plot to use

2007-12-20 Thread hadley wickham
> Perhaps as long as you're learning a new plotting system, you might also > check out whether ggplot2 might be an option. > > I did a quick and dirty version (which I'm sure Hadley can improve and > also remind me how to get rid of the legend that shows the "3" that I > set the size to). > > Assum

Re: [R] Reshape Dataframe

2007-12-20 Thread hadley wickham
On Dec 20, 2007 4:56 PM, Bert Jacobs <[EMAIL PROTECTED]> wrote: > Hi, > > The problem is probably that my Var4, does not contain number but factor > information, and therefore I think Gabor's suggestion does not work. > The same holds for Hadley's solution with the functions melt/cast, where the >

Re: [R] Reshape Dataframe

2007-12-20 Thread Bert Jacobs
Hi, The problem is probably that my Var4, does not contain number but factor information, and therefore I think Gabor's suggestion does not work. The same holds for Hadley's solution with the functions melt/cast, where the resulting dataframe looks OK, but the dataframe is filled with the number o

Re: [R] data shape

2007-12-20 Thread tom sgouros
Charilaos Skiadas <[EMAIL PROTECTED]> wrote: > > 2. What's the easiest way to read such a data array from a text > > file? > > I can do some editing of a csv file produced from the > > spreadsheet, > > but don't really know what to aim for. > > Here is the code I used to read your ex

Re: [R] data shape

2007-12-20 Thread Charilaos Skiadas
HI Tom, On Dec 20, 2007, at 9:06 AM, Tom Sgouros wrote: > > Hello: > > I have been give a spreadsheet to work with formed as one big table. > What it consists of is a 10-row-by-40-column table for each of > about 70 > different locations. In other words, the table row names are repeated > 70 ti

[R] test for factor effect with nested glm

2007-12-20 Thread Marie-Agnes Coutellec
Dear all, I use a nested design with lm and glm, with factor2 nested within factor1. In order to test for the significance of both factors, I use anova tables on the obtained models such as follows: /> mod1<-lm(A~factor1/factor2) > amod1<-anova(mod1, test="F") Analysis of Variance Table Respon

Re: [R] continue a for() when occurs errors

2007-12-20 Thread Benilton Carvalho
your description is pretty vague, at least for me... it would be very helpful to have the "commented, minimal, self- contained, reproducible code"... but, anyways, you might want to take a look at the try() command. best b On Dec 20, 2007, at 3:24 AM, Milton Cezar Ribeiro wrote: Dear all,

[R] alternate storage options

2007-12-20 Thread dxc13
useR's. I am working with an algorithm in which I will need to create combinations of all the points I have in a matrix. When I have 2 variables, I simply use expand.grid() to do this. Sometimes I am faced with 3 or more variables and if I run expand.grid(), R cannot process it due to the huge

[R] creating a factor from dates by subject?

2007-12-20 Thread Michael A. Miller
Dear R-help, I have a data set consisting of measurements made on multiple subjects. Measurement sessions are repeated for each subject on multiple dates. Not all subjects have the same number of sessions. To create a factor that represents the session, I do the following: data <- read.csv('te

Re: [R] Factor Madness

2007-12-20 Thread John Kane
You may be haning Ion coerced into a factor. Have a look at http://finzi.psych.upenn.edu/R/Rhelp02a/archive/98260.html for some discussion of this. I find that I usually set options(stringsAsFactors = FALSE) just because of this but as Gabor points out it may have its own disadvantages in shar

Re: [R] Reshape Dataframe

2007-12-20 Thread John Kane
reshape package. --- Bert Jacobs <[EMAIL PROTECTED]> wrote: > > In which package do I find the "cast" function. At > the moment it's not > recognized. > Thx, > Bert > > -Original Message- > From: John Kane [mailto:[EMAIL PROTECTED] > Sent: 19 December 2007 17:57 > To: Bert Jacobs; 'ha

Re: [R] How can I extract the AIC score from a mixed model object produced using lmer?

2007-12-20 Thread Douglas Bates
On Dec 19, 2007 9:42 AM, David Hewitt <[EMAIL PROTECTED]> wrote: > > > David Barron-3 wrote: > > > > You can calculate the AIC as follows: > > > > (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) > > aic1 <- AIC(logLik(fm1)) > > > > > Is AIC() [extractAIC()] "valid" for models with rand

Re: [R] custom subset method / handling columns selection as logic in '...' parameter

2007-12-20 Thread Martin Morgan
Eric -- Please don't cross post Please simplify your example so that others do not have to work hard to understand what you are asking See additional response on the Bioconductor mailing list. Martin "Eric Lecoutre" <[EMAIL PROTECTED]> writes: > Dear R-helpers & bioconductor > > > Sorry for c

Re: [R] Reshape Dataframe

2007-12-20 Thread Bert Jacobs
In which package do I find the "cast" function. At the moment it's not recognized. Thx, Bert -Original Message- From: John Kane [mailto:[EMAIL PROTECTED] Sent: 19 December 2007 17:57 To: Bert Jacobs; 'hadley wickham' Cc: [EMAIL PROTECTED] Subject: Re: [R] Reshape Dataframe I think if yo

Re: [R] 4 questions regarding hypothesis testing, survey package, ts on samples, plotting

2007-12-20 Thread David Winsemius
eugen pircalabelu <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > I have 4 questions which trouble me: > snip 1-3 > > 4. I want to modify the scale of my axes within a plot but i really > could not find this option. I think there is such an option, but i > can not find it. > x<-rn

[R] data shape

2007-12-20 Thread Tom Sgouros
Hello: I have been give a spreadsheet to work with formed as one big table. What it consists of is a 10-row-by-40-column table for each of about 70 different locations. In other words, the table row names are repeated 70 times, once for each of the locations (whose names also appear in the same

Re: [R] plot3d, wireframe, persp help

2007-12-20 Thread dxc13
When using the wireframe function you need to create a 2D grid for your two X variables. Try the "expand.grid" function on your data, then run the wireframe on that result Brad B-2 wrote: > > Hello, > I am trying to get a surface plot of a data set that looks like the > following, > 1 2

[R] custom subset method / handling columns selection as logic in '...' parameter

2007-12-20 Thread Eric Lecoutre
Dear R-helpers & bioconductor Sorry for cross-posting, this concerns R-programming stuff applied on Bioconductor context. Also sorry for this long message, I try to be complete in my request. I am trying to write a subset method for a specific class (ExpressionSet from Bioconductor) allowing sel

Re: [R] continue a for() when occurs errors

2007-12-20 Thread Gabor Grothendieck
Its a FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-capture-or-ignore-errors-in-a-long-simulation_003f On Dec 20, 2007 3:24 AM, Milton Cezar Ribeiro <[EMAIL PROTECTED]> wrote: > Dear all, > > I am simulating some regressions in a for() looping and sometimes occours > some error and

[R] Multicore computation in Windows network: How to set up Rmpi

2007-12-20 Thread Samu Mäntyniemi
R-users, My question is related to earlier posts about benefits of quadcore over dualcore computers; I am trying to setup a cluster of windows xp computers so that eventually I could make use of 10-20 cpu:s, but for learning how to do this, I am playing around with two laptops. I thought that the

Re: [R] plot3d, wireframe, persp help

2007-12-20 Thread Henrique Dallazuanna
See 'akima' package. On 20/12/2007, Brad B <[EMAIL PROTECTED]> wrote: > Hello, > I am trying to get a surface plot of a data set that looks like the > following, > 1 2 5.6 > 5 9 2.4 > 9 8 9.8 > ... to (60,000 rows down) > > From my homework, the persp function only works with evenly s

[R] Greetings to you.

2007-12-20 Thread Mr. Ray Orfan
Greetings to you. My name is Mr. Ray Orfan the Personal Assistant (PA) to the Head of an important International Organization. I have been directed to seek foriegn partnership with an interested foreigner on an issue relating to money. The issue invloved will be beneficial to all concerned an

[R] plot3d, wireframe, persp help

2007-12-20 Thread Brad B
Hello, I am trying to get a surface plot of a data set that looks like the following, 1 2 5.6 5 9 2.4 9 8 9.8 ... to (60,000 rows down) From my homework, the persp function only works with evenly spaced data points with the z data beeing in a matrix. my data is not in that f

Re: [R] Obtaining replicates numbers of a vector

2007-12-20 Thread Moshe Olshansky
You could do: > x <- c('A','B','A','C','C','B') > x [1] "A" "B" "A" "C" "C" "B" > mapply(function(i) sum(x[1:i] == x[i]),1:length(x)) [1] 1 1 2 1 2 2 > --- Eric Lecoutre <[EMAIL PROTECTED]> wrote: > Dear R-help, > > I am trying to have a generic way to assess the > replicates in a character >

Re: [R] Aggregating by a grouping

2007-12-20 Thread Moshe Olshansky
One possibility is: > x [1] "A" "B" "C" "D" "A" "C" "D" "B" > y [1] 10 11 9 8 12 4 5 7 > basic_map [[1]] [1] "A" "B" [[2]] [1] "C" "D" > a <- which(sapply(basic_map,function(u) x %in% u),arr.ind=TRUE) > aggregate(y,list(a[order(a[,1]),2]),sum) Group.1 x 1 1 40 2 2 26 > ---

Re: [R] Code for articles in R news?

2007-12-20 Thread John Fox
Dear Ajay, At present, unfortunately, we have so mechanism for distributing code associated with R News articles. We're considering changes to the infrastructure that supports R News, including providing the kind of facility that you suggest. I'm afraid that the best that I can suggest for now is

Re: [R] Correlation when one variable has zero variance (polychoric?)

2007-12-20 Thread John Fox
Dear Jose, > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Jose > Sent: December-19-07 11:27 AM > To: [EMAIL PROTECTED] > Subject: Re: [R] Correlation when one variable has zero variance > (polychoric?) > > Dear John, > > > I also ran

Re: [R] Computing normal conf.intervals

2007-12-20 Thread Peter Dalgaard
Jonas Malmros wrote: > Hi everybody, > > I wonder if there is a built-in function similar to Matlab's "normfit" > which computes 95% CI based on the normality assumption. > So, I have a vector of values and I want to calculate 95% normal CI. > Of course, I could write my own function, no problem, b

Re: [R] Genetic algorithm for feature selection

2007-12-20 Thread Rolf Wester
Thank you very much for your reply. I found the information on your home page very useful. What I want to do is a PLS regression of a data set with 60 features for calibration purposes. In order to optimize the performance of the calibration I have to find out what features to use in the PLS r

[R] Computing normal conf.intervals

2007-12-20 Thread Jonas Malmros
Hi everybody, I wonder if there is a built-in function similar to Matlab's "normfit" which computes 95% CI based on the normality assumption. So, I have a vector of values and I want to calculate 95% normal CI. Of course, I could write my own function, no problem, but I still wonder if built-in fu

Re: [R] auto named savings (pngs & data-frames)

2007-12-20 Thread Henrique Dallazuanna
Try this: jpeg("UserDA%02dT.jpg") sapply(1:10, function(x)plot(rnorm(100))) dev.off() On 20/12/2007, Daniel Jegelka <[EMAIL PROTECTED]> wrote: > Hello, i only got a small problem. > > i try to create automatic new dataframes, or png´s. the main problem i > got is: > > how can i create automatic a

[R] auto named savings (pngs & data-frames)

2007-12-20 Thread Daniel Jegelka
Hello, i only got a small problem. i try to create automatic new dataframes, or png´s. the main problem i got is: how can i create automatic a new name for a file (read out by simply "for") - i tried to use "(paste...) but theres an errormessage, about a wrong declination. R told it is as.charact

Re: [R] continue a for() when occurs errors

2007-12-20 Thread Ted Harding
On 20-Dec-07 08:24:40, Milton Cezar Ribeiro wrote: > Dear all, > > I am simulating some regressions in a for() looping and sometimes > occours some error and the R stop my batch processing. I would like do > save the step where the error happned and continue my for() looping. > Is there a way to d

Re: [R] assigning and saving datasets in a loop, with names changing with "i"

2007-12-20 Thread Henrik Bengtsson
library(R.utils); for (ii in 1:12) { value <- my.fun(my.list[ii]); saveObject(value, file=sprintf("data%02d.RData", ii)); rm(value); gc(); } for (ii in 1:12) { value <- loadObject(sprintf("data%02d.RData", ii)); } On 18/12/2007, Marie Pierre Sylvestre <[EMAIL PROTECTED]> wrote: > Dear R

Re: [R] factor manipulation: edgelist to a matrix?

2007-12-20 Thread Dimitris Rizopoulos
one way is the following: V1 <- c(1,1,1,2,3,3,3,3) V2 <- LETTERS[c(1,1,2,1,3,1,3,2)] tab <- table(V1, ave(V1, V1, FUN = seq_along)) vals <- as.vector(t(tab)) vals[vals != 0] <- unlist(split(V2, V1)) vals[vals == 0] <- NA matrix(vals, nrow(tab), ncol(tab), TRUE) I hope it helps. Best, Dimitris

[R] continue a for() when occurs errors

2007-12-20 Thread Milton Cezar Ribeiro
Dear all, I am simulating some regressions in a for() looping and sometimes occours some error and the R stop my batch processing. I would like do save the step where the error happned and continue my for() looping. Is there a way to do that? Thanks In Advance. Miltinho para armazenamento!

[R] R News, volume 7, issue 3 is now available

2007-12-20 Thread Torsten Hothorn
Dear useRs, The December 2007 issue of `R News' is now available on CRAN under the Documentation/Newsletter link. Torsten (on behalf of the R News Editorial Board) ___ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __

Re: [R] Correlation when one variable has zero variance (polychoric?)

2007-12-20 Thread Jose
Dear John, > I also ran the same analysis in 2005 > (what has changed in the package polycor since then, I don't know) and the > results were different. I think back then I contrasted them with SAS > and they were the same. John> I don't entirely follow this. Are you referring to the table above