Re: [R] [FORGED] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) is not TRUE"

2015-09-22 Thread Rory Wilson
Hi Rolf,Yes, a reprodicuble example would be good - but it appears to be trouble with something within the data, and I cannot upload all the data here. Jean indicated the issue could be with NAs in the data, and I am inclined to agree. I will look more into that angle and see if something become

Re: [R] [FORGED] Re: Compare two normal to one normal

2015-09-22 Thread Rolf Turner
On 23/09/15 16:38, Mark Leeds wrote: John: After I sent what I wrote, I read Rolf's intelligent response. I didn't realize that there are boundary issues so yes, he's correct and my approach is EL WRONGO. I feel very not good that I just sent that email being that it's totally wrong. My apologie

[R] doubt with Odds ratio - URGENT HELP NEEDED

2015-09-22 Thread Rosa Oliveira
Dear all, I’m trying to compute Odds ratio and OR confidence interval. I’m really naive, sorry for that. I attach my data and my code. I’m having lots of errors: 1. Error in data.frame(tas1 = tas.data$tas_d2, tas2 = tas.data$tas_d3, tas3 = tas.data$tas_d4, : arguments imply differing nu

[R] Top Trading Cycles (TTC) Algorithm in R

2015-09-22 Thread VictorDelgado
Hello R users I'm posting here my recent implementation of Top Trading Cycles Algorithm in R. For more details, look for Shapley and Scarf "On Cores and Indivisibility" Journal of Mathematical Economics, 1, 23-37. ttc.many <- function(m, n, preference.row, preference.col,expand) { # m = row numbe

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread BARRETT, Oliver
Hi all, Thank you so much for your input. Just to clarify, of the 32% plagiarism detected only 27-8% has come from the regressions but this is expected as the appendix where the regressions are contained is much more dense with text and numbers than the rest of the document. The other 5% will

Re: [R] Fixing Gale-Shapley Algorithm for R

2015-09-22 Thread VictorDelgado
Hello R Developers, I have made a new code for this algorithm in R. In the end I present an very small example with system.time computing. Gale-Shapley Many-to-One (Note that many are always in Rows): # # gsa

[R] Loading data chartseries

2015-09-22 Thread bgnumis bgnum
Hi all, I want to plot this data on file.txt that has this format 01/01/2000;970,1877 02/01/2000;970,2224 03/01/2000;969,0336 04/01/2000;958,3023 05/01/2000;952,8527 I´m trying to plot with quantmode with this code but it is not working X<-read.table("file.txt", col.names=c("Date","LAST"), sep

[R] Running R on a hosting o server

2015-09-22 Thread bgnumis bgnum
Hi all, Hope I can Explain: I want to "run" online some function (code written by me) so that this code "saves" an output file on my server and my html webpage read the file R plots and save (really manually I would run R function, open Filezilla, and pass the output png o jpg file). Is it possi

Re: [R] Compare two normal to one normal

2015-09-22 Thread Mark Leeds
John: After I sent what I wrote, I read Rolf's intelligent response. I didn't realize that there are boundary issues so yes, he's correct and my approach is EL WRONGO. I feel very not good that I just sent that email being that it's totally wrong. My apologies for noise and thanks Rolf for the cor

Re: [R] Compare two normal to one normal

2015-09-22 Thread Mark Leeds
Hi John: For the log likelihood in the single case, you can just calculate it directly using the normal density, so the sum from i = 1 to n of f(x_i, uhat, sigmahat) where f(x_i, uhat, sigma hat) is the density of the normal with that mean and variance. so you can use dnorm with log = TRUE. Of c

Re: [R] Compare two normal to one normal

2015-09-22 Thread Rolf Turner
On 23/09/15 13:39, John Sorkin wrote: Charles, I am not sure the answer to me question, given a dataset, how can one compare the fit of a model of the fits the data to a mixture of two normal distributions to the fit of a model that uses a single normal distribution, can be based on the glm mod

Re: [R] Compare two normal to one normal

2015-09-22 Thread John Sorkin
Charles, I am not sure the answer to me question, given a dataset, how can one compare the fit of a model of the fits the data to a mixture of two normal distributions to the fit of a model that uses a single normal distribution, can be based on the glm model you suggest. I have used normalmi

Re: [R] retaining characters in a csv file

2015-09-22 Thread Rolf Turner
On 23/09/15 11:19, peter dalgaard wrote: On 23 Sep 2015, at 00:33 , Rolf Turner wrote: [read.csv() doesn't distinguish "123.4" from 123.4] IMHO this is a bug in read.csv(). Dunno about that: pd$ cat ~/tmp/junk.csv "1";1 2;"2" pd$ open !$ open ~/tmp/junk.csv And lo and behold, Excel o

Re: [R] retaining characters in a csv file

2015-09-22 Thread Rolf Turner
On 23/09/15 12:48, Duncan Murdoch wrote: On 22/09/2015 6:33 PM, Rolf Turner wrote: IMHO this is a bug in read.csv(). No, it's a bug in "Rolf Turner", who believes in fairies at the end of his garden, rather than in documentation for file formats. Naturally, I beg to differ. The docume

Re: [R] [FORGED] Re: 'R' Software Output Plagiarism

2015-09-22 Thread Rolf Turner
RIGHT ON!!! I concur most heartily with the sentiments expressed by Duncan. cheers, Rolf On 23/09/15 12:33, Duncan Murdoch wrote: On 22/09/2015 4:06 PM, peter dalgaard wrote: Marc, I don't think Copyright/Intellectual property issues factor into this. Urkund and similar tools are to my kn

Re: [R] retaining characters in a csv file

2015-09-22 Thread Duncan Murdoch
On 22/09/2015 6:33 PM, Rolf Turner wrote: > On 23/09/15 10:00, Therneau, Terry M., Ph.D. wrote: >> I have a csv file from an automatic process (so this will happen >> thousands of times), for which the first row is a vector of variable >> names and the second row often starts something like this: >

Re: [R] retaining characters in a csv file

2015-09-22 Thread Duncan Murdoch
On 22/09/2015 7:19 PM, peter dalgaard wrote: > >> On 23 Sep 2015, at 00:33 , Rolf Turner wrote: >> > > [read.csv() doesn't distinguish "123.4" from 123.4] > >> IMHO this is a bug in read.csv(). >> > > Dunno about that: > > pd$ cat ~/tmp/junk.csv > "1";1 > 2;"2" > pd$ open !$ > open ~/tmp/jun

Re: [R] retaining characters in a csv file

2015-09-22 Thread Duncan Murdoch
On 22/09/2015 6:00 PM, Therneau, Terry M., Ph.D. wrote: > I have a csv file from an automatic process (so this will happen thousands of > times), for > which the first row is a vector of variable names and the second row often > starts > something like this: > > 5724550,"000202075214",2005.02.

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread Duncan Murdoch
On 22/09/2015 4:06 PM, peter dalgaard wrote: > Marc, > > I don't think Copyright/Intellectual property issues factor into this. Urkund > and similar tools are to my knowledge entirely about plagiarism. So the issue > would seem to be that the R output is considered identical or nearly > indenti

Re: [R] retaining characters in a csv file

2015-09-22 Thread peter dalgaard
> On 23 Sep 2015, at 00:33 , Rolf Turner wrote: > [read.csv() doesn't distinguish "123.4" from 123.4] > IMHO this is a bug in read.csv(). > Dunno about that: pd$ cat ~/tmp/junk.csv "1";1 2;"2" pd$ open !$ open ~/tmp/junk.csv And lo and behold, Excel opens with 1 1 2 2 and all cells num

Re: [R] retaining characters in a csv file

2015-09-22 Thread Arunkumar Srinivasan
data.table's fread reads this as expected. Quoted strings aren't coerced. sapply(fread('5724550,"000202075214",2005.02.17,2005.02.17,"F"\n'), class) # V1 V2 V3 V4 V5 # "integer" "character" "character" "character" "character" Best, Arun. On Wed, Sep

Re: [R] retaining characters in a csv file

2015-09-22 Thread David Winsemius
On Sep 22, 2015, at 3:00 PM, Therneau, Terry M., Ph.D. wrote: > I have a csv file from an automatic process (so this will happen thousands of > times), for which the first row is a vector of variable names and the second > row often starts something like this: > > 5724550,"000202075214",2005.0

Re: [R] retaining characters in a csv file

2015-09-22 Thread Rolf Turner
On 23/09/15 10:00, Therneau, Terry M., Ph.D. wrote: I have a csv file from an automatic process (so this will happen thousands of times), for which the first row is a vector of variable names and the second row often starts something like this: 5724550,"000202075214",2005.02.17,2005.02.17,"F", .

Re: [R] Compare two normal to one normal

2015-09-22 Thread Charles C. Berry
On Tue, 22 Sep 2015, John Sorkin wrote: In any event, I still don't know how to fit a single normal distribution and get a measure of fit e.g. log likelihood. Gotta love R: y <- rnorm(10) logLik(glm(y~1)) 'log Lik.' -17.36071 (df=2) HTH, Chuck

Re: [R] Compare two normal to one normal

2015-09-22 Thread John Sorkin
Bert I am surprised by your response. Statistics serves two purposes: estimation and hypothesis testing. Sometimes we are fortunate and theory, physiology, physics, or something else tell us what is the correct, or perhaps I should same most adequate model. Sometimes theory fails us and we wish

Re: [R] retaining characters in a csv file

2015-09-22 Thread Hadley Wickham
The problem is that quotes in csv files are commonly held to me meaningless (i.e. they don't automatically force components to be strings). Earlier this morning I committed a fix to readr so that numbers starting with a sequence of zeros are read as character strings. You may want to try out the d

[R] retaining characters in a csv file

2015-09-22 Thread Therneau, Terry M., Ph.D.
I have a csv file from an automatic process (so this will happen thousands of times), for which the first row is a vector of variable names and the second row often starts something like this: 5724550,"000202075214",2005.02.17,2005.02.17,"F", . Notice the second variable which is a c

Re: [R] vector manipulations -- differences

2015-09-22 Thread Frank Schwidom
And if we want to use the approach of William Dunlap for sequence.optimization , then we can write: rev( xr[ seq_len(sum(vec)) - rep.int(cumsum(c(0L, vec[-length(vec)])), vec)] - rep.int( xr[ -1], vec)) Regards. On 2015-09-22 23:43:10, Frank Schwidom wrote: > Hi, > > xr <- rev( x) > vec <- 1:

Re: [R] vector manipulations -- differences

2015-09-22 Thread Frank Schwidom
Hi, xr <- rev( x) vec <- 1:(length( x) - 1) rev( xr[ sequence( vec)] - rep.int( xr[ -1], vec)) On 2015-09-21 14:17:40, Dan D wrote: > I need an efficient way to build a new n x (n-1)/2 vector from an n-vector x > as: > > c(x[-1]-x[1], x[-(1:2)]-x[2], ... , x[-(1:(n-1)] - x[n-1]) > > x is incre

Re: [R] [FORGED] error in mlogit.optim

2015-09-22 Thread Rolf Turner
On 23/09/15 03:33, Alaa Sindi wrote: Hi all I hope you are doing well. I am trying to install and use mlogit.optim and getting this error. Error: could not find function “mlogit.optim" Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib

Re: [R] [FORGED] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) is not TRUE"

2015-09-22 Thread Rolf Turner
On 23/09/15 01:18, Rory Wilson wrote: Hello all, I am trying to run a random intercept model using lme4. The random effect is a factor of 29 possibilities, making a model with one random effect (one level). It is just a linear model. There are 713 observations. However, when trying to run the m

Re: [R] Compare two normal to one normal

2015-09-22 Thread Bert Gunter
I'll be brief in my reply to you both, as this is off topic. So what? All this statistical stuff is irrelevant baloney(and of questionable accuracy, since based on asymptotics and strong assumptions, anyway) . The question of interest is whether a mixture fit better suits the context, which only

Re: [R] Compare two normal to one normal

2015-09-22 Thread John Sorkin
I am not sure AIC or BIC would be needed as the two normal distribution has at least two additional parameters to estimate; mean 1, var1, mean 2, var 2 where as the one normal has to estimate only var1 and var2.In any event, I don't know how to fit the single normal and get values for the loglik

Re: [R] Compare two normal to one normal

2015-09-22 Thread Mark Leeds
That's true but if he uses some AIC or BIC criterion that penalizes the number of parameters, then he might see something else ? This ( comparing mixtures to not mixtures ) is not something I deal with so I'm just throwing it out there. On Tue, Sep 22, 2015 at 4:30 PM, Bert Gunter wrote: > Tw

Re: [R] Compare two normal to one normal

2015-09-22 Thread John Sorkin
Bert,Better, perhaps, but will something like the LR test be significant? Adding an extra parameter to a linear regression almost always improves the R2, the if one compares models, the model with the extra parameter is not always significantly better. John P.S. Please forgive the appeal to "sig

Re: [R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-22 Thread Frank Schwidom
Hi I have to correct myself, this last solution is not universally valid here a better one: tmp1 <- ( 1 - outer( max( x):1, x, FUN='-')) tmp1[ tmp1 > 0] On 2015-09-17 21:06:30, Frank Schwidom wrote: > > how abount a more complicated one? > > outer( 1:5, 1:5, '-')[ outer( 1:5, 1:5, '>')] > [

Re: [R] Compare two normal to one normal

2015-09-22 Thread Bert Gunter
Two normals will **always** be a better fit than one, as the latter must be a subset of the former (with identical parameters for both normals). Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Tue

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread Marc Schwartz
Peter, Great distinction. I was leaning in the direction that the "look and feel" of the output (standard wording, table structure, column headings, significance stars and so forth in the output) is similar to whatever Urkund is using as the basis for the comparison and less so on an exact re

[R] Weighted Ridge Regression with GCV Optimization

2015-09-22 Thread Preetam Pal
Hi R-users, I am having problems while implementing the following model: 1. I have numerical regressors (GDP, HPA and FX observed quarterly) and need to predict the numerical variable Y. 2. I have to run *weighted Ridge Regression* where the weights of the squared residuals are decrea

[R] Randomness tests

2015-09-22 Thread Giorgio Garziano
Hi, to test randomness of time series whose values can only be +1 and -1, are all following randomness tests applicable or only a part of ? cox.stuart.test difference.sign.test bartels.rank.test rank.test runs.test Tests provided by the randtests R package. Thanks. Giorgio Garziano

[R] Compare two normal to one normal

2015-09-22 Thread John Sorkin
I have data that may be the mixture of two normal distributions (one contained within the other) vs. a single normal. I used normalmixEM to get estimates of parameters assuming two normals: GLUT <- scale(na.omit(data[,"FCW_glut"])) GLUT mixmdl = normalmixEM(GLUT,k=1,arbmean=TRUE) summary(mixmdl

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread Mitchell Maltenfort
Isn't plagiarism detection based on overlaps with sentence structure? That way, it would catch plagiarism if someone simply did a find-and-replace. But that would also catch regressions with the same output format. How long was the original thesis? If 25% of it was all regression output, sounds l

Re: [R] Error in eval(expr, envir, enclos) : could not find function

2015-09-22 Thread William Dunlap
You left out the rest of the error message (the name of the function it is looking for is key): > lm(Y ~ nosuchfuncion(X), data=data.frame(Y=1:10,X=log(1:10))) Error in eval(expr, envir, enclos) : could not find function "nosuchfuncion" Bill Dunlap TIBCO Software wdunlap tibco.com

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread peter dalgaard
Marc, I don't think Copyright/Intellectual property issues factor into this. Urkund and similar tools are to my knowledge entirely about plagiarism. So the issue would seem to be that the R output is considered identical or nearly indentical to R output in other published orotherwise submitted

Re: [R] Error in eval(expr, envir, enclos) : could not find function

2015-09-22 Thread Mark Sharp
Please provide a context for your question. See the posting guide referenced below for instructions on providing commented, minimal, self-contained, reproducible code. If you can show how to produce the error, someone can almost certainly show you how to avoid it. Mark R. Mark Sharp, Ph.D. msh.

Re: [R] unixtime conversion

2015-09-22 Thread jim holtman
you can also do: > structure(1183377301, class = c("POSIXct", "POSIXt")) [1] "2007-07-02 07:55:01 EDT" > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Sep 22, 2015 at 8:01 AM, JonyGreen wrote:

[R] Error in eval(expr, envir, enclos) : could not find function

2015-09-22 Thread Alaa Sindi
hi all I am getting this error "Error in eval(expr, envir, enclos) : could not find function “ do you have an idea what might cause this problem. thanks __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Jianling Fan
great, Thanks a lot! On 22 September 2015 at 12:07, Gabor Grothendieck wrote: > You may have to do without masking and switch back to nls. dproot2 and fo > are from prior post. > > # to mask Rm6 omit it from start and set it explicitly > st <- c(Rm1=1.01, Rm2=1.01, Rm3=1.01, Rm4=6.65, Rm5=1.01

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Gabor Grothendieck
You may have to do without masking and switch back to nls. dproot2 and fo are from prior post. # to mask Rm6 omit it from start and set it explicitly st <- c(Rm1=1.01, Rm2=1.01, Rm3=1.01, Rm4=6.65, Rm5=1.01, d50=20, c=-1) Rm6 <- 1 fm.nls <- nls(fo, dproot2, start = st) AIC(fm.nls) summary(fm.nl

Re: [R] Accounting for correlated random effects in coxme

2015-09-22 Thread Therneau, Terry M., Ph.D.
I've been away for a couple weeks and am now catching up on email. The issue is that the coxme code does not have conversions built-in for all of the possible types of sparse matrix. Since it assumes that the variance matrix must be symmetric, the non-neccarily-symmetric dgCMatrix class is not

Re: [R] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) is not TRUE"

2015-09-22 Thread Adams, Jean
Rory, When I searched online, I found an issue with lme4 on GitHub that suggests this error is "due to NA values in non-factor variables". https://github.com/lme4/lme4/issues/246 Hope this helps. Jean On Tue, Sep 22, 2015 at 8:18 AM, Rory Wilson wrote: > Hello all, I am trying to run a random

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread John Kane
This is just guessing but the reason is probably that the regression output (not including the specific numbers, and your variable names) is standard R output as already noted. It probably appears in many other theses and dissertations , in books on R, and possibly in appendices in published bo

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread John Kane
Very good point about the referencing. I wonder if this is happening to users of Stata or SAS as well? John Kane Kingston ON Canada > -Original Message- > From: marc_schwa...@me.com > Sent: Tue, 22 Sep 2015 11:24:13 -0500 > To: bgunter.4...@gmail.com > Subject: Re: [R] 'R' Software Out

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Jianling Fan
Hello Prof. Nash, My regression works good now. But I found another problem when I using nlxb. In the output, the SE, t-stat, and p-value are not available. Furthermore, I can't extract AIC from the output. The output looks like below: Do you have any suggestion for this? Thanks a lot! Regards,

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread Marc Schwartz
Hi, With the usual caveat that I Am Not A Lawyerand that I am not speaking on behalf of any organization... My guess is that they are claiming that the output of R, simply being copied and pasted verbatim into your thesis constitutes the use of copyrighted output from the software. It is

Re: [R] 'R' Software Output Plagiarism

2015-09-22 Thread Bert Gunter
1. It is highly unlikely that we could be of help (unless someone else has experienced this and knows what happened). You will have to contact the Urkund people and ask them why their algorithms raised the flags. 2. But of course, the regression methodology is not "your own" -- it's just a standar

Re: [R] [FORGED] Re: Weighted skewness and curtosis

2015-09-22 Thread SEMson
I´m also looking for an answer on this question right now. You can´t use a weight in the moments package, but i found a weighted.moments()-function in the acid-package ( weighted.moments-function ). If your data has NA, you can do t

[R] 'R' Software Output Plagiarism

2015-09-22 Thread BARRETT, Oliver
Dear 'R' community support, I am a student at Skema business school and I have recently submitted my MSc thesis/dissertation. This has been passed on to an external plagiarism service provider, Urkund, who have scanned my document and returned a plagiarism report to my professor having detect

Re: [R] unixtime conversion

2015-09-22 Thread JonyGreen
you can try this free online timestamp converter to convert timestamp to readable date. -- View this message in context: http://r.789695.n4.nabble.com/unixtime-conversion-tp829898p4712599.html Sent from the R help mailing list archive at Nabbl

Re: [R] Millisecond TimeStamps

2015-09-22 Thread JonyGreen
you can try this free online unix timestamp creator , you can get the current time stamp in milliseconds. -- View this message in context: http://r.789695.n4.nabble.com/Millisecond-TimeStamps-tp3403594p4712598.html Sent from the R help mailing

Re: [R] Need data labels to jitter with datapoints in boxplot

2015-09-22 Thread smheas
Thank you both for your responses! I ended up going with PIKAL Petr's suggestion. -- View this message in context: http://r.789695.n4.nabble.com/Need-data-labels-to-jitter-with-datapoints-in-boxplot-tp4712380p4712605.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) is not TRUE"

2015-09-22 Thread Rory Wilson
Hello all, I am trying to run a random intercept model using lme4. The random effect is a factor of 29 possibilities, making a model with one random effect (one level). It is just a linear model. There are 713 observations. However, when trying to run the model I receive the error "Error: (p <-

[R] error in mlogit.optim

2015-09-22 Thread Alaa Sindi
Hi all I hope you are doing well. I am trying to install and use mlogit.optim and getting this error. Error: could not find function “mlogit.optim" Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Jianling Fan
Hello Gabor, It is very kind of you to reply and give suggestion so rapid. I will try to learn and use it. Thanks very much for your help! Best regards, Jianling On 22 September 2015 at 06:45, Gabor Grothendieck wrote: > Or if you really can't bear to write out 20 terms have R do it for you:

Re: [R] (no subject)

2015-09-22 Thread John Kane
You seem to have sent a blank message. John Kane Kingston ON Canada > -Original Message- > From: fathi.s...@gmail.com > Sent: Tue, 22 Sep 2015 16:29:07 +0330 > To: r-help@r-project.org > Subject: [R] (no subject) > > > > [[alternative HTML version deleted]] > > ___

[R] (no subject)

2015-09-22 Thread arsalan fathi
[[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide comm

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Gabor Grothendieck
Or if you really can't bear to write out 20 terms have R do it for you: # number of terms is the number of unique values in ref column nterms <- length(unique(dproot$ref)) dproot2 <- do.call(data.frame, transform(dproot, ref = outer(dproot$ref, seq(nterms), "==") + 0)) # construct the formula as

Re: [R] How to coerce a parameter in nls?

2015-09-22 Thread Gabor Grothendieck
Just write out the 20 terms. On Mon, Sep 21, 2015 at 10:26 PM, Jianling Fan wrote: > Hello, Gabor, > > Thanks again for your suggestion. And now I am trying to improve the > code by adding a function to replace the express "Rm1 * ref.1 + Rm2 * > ref.2 + Rm3 * ref.3 + Rm4 * ref.4 + Rm5 * ref.5 +

Re: [R] store results in loop

2015-09-22 Thread Michael Dewey
Dear Nico Comment inline On 22/09/2015 10:36, Nico Gutierrez wrote: Hi All, very rusty in R.. my results get overwritten when try to store within the loop. This my code: ListS=unique(data$Spec) Stat<- numeric(0) for(i in 5){ Is that what you meant? I would have expected something like 1:5

Re: [R] store results in loop

2015-09-22 Thread Jim Lemon
Hi Nico, A bit difficult to see what is happening without the data, but two suggestions: smoothC=mean(SS$Cc[maxC + c(-2:2)],na.rm=TRUE) ... Stat[i]<-Index Jim On Tue, Sep 22, 2015 at 7:36 PM, Nico Gutierrez wrote: > Hi All, > > very rusty in R.. my results get overwritten when try to store wi

[R] store results in loop

2015-09-22 Thread Nico Gutierrez
Hi All, very rusty in R.. my results get overwritten when try to store within the loop. This my code: ListS=unique(data$Spec) Stat<- numeric(0) for(i in 5){ SS=subset(data,data$Spec==ListS[i]) maxC<- which.max(SS$Cc) smoothC=mean(SS$Cc[maxC + c(-2:2)]) currC=tail(SS,1)$Cc Index=currC/smoothC St

Re: [R] Extract from data.frame

2015-09-22 Thread Nico Gutierrez
Thank you all! n On Mon, Sep 21, 2015 at 10:00 PM, Bert Gunter wrote: > No. > > > On Mon, Sep 21, 2015 at 10:58 AM, John McKown > wrote: > > On Mon, Sep 21, 2015 at 9:52 AM, Nico Gutierrez < > nico.gutierr...@gmail.com> > > wrote: > > > >> Hi All, > >> > >> I need to do the following operation