Re: [R] Problem with

2012-11-10 Thread Haszun
Thanks for help, now its working. -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-tp4649082p4649161.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Problem with recursion

2012-11-10 Thread Haszun
I know that maybe it will be stupid question. What iswrong with it (i think that i have to do the stop moment, but i dont know how) fibbonacci=function(x) { while(x0) { if (x==1 || x==2) { return(1) } else fibbonacci(x-1)+fibbonacci(x-2) } } -- View this message in context:

Re: [R] Problem with recursion

2012-11-10 Thread R. Michael Weylandt
On Sat, Nov 10, 2012 at 7:41 AM, Haszun crazyste...@tlen.pl wrote: I know that maybe it will be stupid question. What iswrong with it (i think that i have to do the stop moment, but i dont know how) fibbonacci=function(x) { while(x0) { if (x==1 || x==2) { return(1) } else

Re: [R] Labeling position barchart

2012-11-10 Thread Jim Lemon
On 11/09/2012 10:33 PM, Geophagus wrote: Hi @ all, I try to set a labeling on simple barchart. I do it with the text function. I want to see values of the x axis (BE_AKT$ammo) above the bars. When I try the following code, the values are shown, but not in the correct position. They should be

Re: [R] Problem with recursion

2012-11-10 Thread Haszun
Thank you for help. -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-recursion-tp4649162p4649166.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] colineraity among categorical variables (multinom)

2012-11-10 Thread Niklas Fischer
Dear all users, Id like to ask you how to make decision about colinearity among categorical independent variables when the model is multinomial logistic regression. Any help is appreciated, Niklas [[alternative HTML version deleted]] __

Re: [R] colineraity among categorical variables (multinom)

2012-11-10 Thread Niklas Fischer
Btw, I tried out variance inflation factor(vif) but it works for glm models(lm) but not multinom or nnet class Bests, 2012/11/10 Niklas Fischer niklasfischer...@gmail.com Dear all users, Id like to ask you how to make decision about colinearity among categorical independent variables when

[R] [R-pkgs] package bit64 with new functionality

2012-11-10 Thread Jens Oehlschlägel
Dear R community, The new version of package 'bit64' - which extends R with fast 64-bit integers - now has fast (single-threaded) implementations of the most important univariate algorithmic operations (those based on hashing and sorting). Package 'bit64' now has methods for 'match', '%in%',

[R] [R-pkgs] Rgraphviz 2.2.1

2012-11-10 Thread Kasper Daniel Hansen
(cross-posted to Graphviz-devel) Rgraphviz 2.2.1 has been released as part of the Bioconductor 2.11 release. Rgraphviz is an R interface to the Graphviz library (www.graphviz.org), which is used for graph layouts. Rgraphviz is one of the most popular packages from the Bioconductor project with

Re: [R] Script for searching in a kinship matrix

2012-11-10 Thread ginger
Hi everybody! I suceeded in extracting the sub-matrix containing just the relevant subjects of this example data (indeed I could retrieve 190 of the 220 subjects of the data example, so that the relative kinship matrix is a 190X190). For the subjects non present in the kinship matrix case-control

Re: [R] Plot in function

2012-11-10 Thread Pauli
Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/Plot-in-function-tp4648576p4649177.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Prediction problem.

2012-11-10 Thread bokaha guy
Dear friends from the R-community, I am Guy Roger and live in Germany. I am student and user of R. I wanted to do some prediction after a linear regression fitting but could´nt because of the following message: yx-predict(lm(y~x4+x5),newdata=data.frame(X4,X5)) Warnmeldung: In predict.lm(lm(y

[R] help on date dataset

2012-11-10 Thread anoumou
Hi everybody, I am beginer in R and I need your precious help. I want to create a small function in R as in sas to retrieve date. I have a file with data that import in R. DATE PAYS nb_pays.ILI. 1 24/04/2009 usa0 2 24/04/2009

Re: [R] Prediction problem.

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 7:56 AM, bokaha guy wrote: Dear friends from the R-community, I am Guy Roger and live in Germany. I am student and user of R. I wanted to do some prediction after a linear regression fitting but could´nt because of the following message:

[R] Problem with if

2012-11-10 Thread Haszun
Why it always gives me a 3? fun=function(x) { + if (x-3) { + return(x) + } else { + if(x2) { + return(x^2-1) + } else { + return(log(x)) + }}} fun(-5) [1] 3 fun(0) [1] 3 fun(10) [1] 3 fun(-10) [1] 3 -- View this message in context:

Re: [R] help on date dataset

2012-11-10 Thread arun
HI, May be this helps: dat1-read.table(text=  DATE   PAYS nb_pays.ILI. 1   24/04/2009 usa    0 2   24/04/2009 usa    0 3   24/04/2009 Mexique    0 4   24/04/2009 Mexique    0 5  

Re: [R] Problem with if

2012-11-10 Thread Haszun
Thank you for help. -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-if-tp4649180p4649182.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Problem with if

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 8:34 AM, Haszun wrote: Why it always gives me a 3? fun=function(x) { + if (x-3) { The above code assigns 3 to x. + return(x) + } else { + if(x2) { + return(x^2-1) + } else { + return(log(x)) + }}} fun(-5) [1] 3 fun(0) [1] 3 fun(10) [1] 3 fun(-10) [1]

Re: [R] help on date dataset

2012-11-10 Thread Rui Barradas
Hello, If I understand it correctly, you have a data.frame whose first column is a date and want to extract all lines between two given dates. If so, try the following. Note that I've added two new arguments to your function. dat - read.table(text= DATE PAYS

Re: [R] help on date dataset

2012-11-10 Thread Rui Barradas
Hello, Sorry, forgot the sum part. extraction - function(DF, date1, date2, format = %Y-%m-%d){ date1 - as.Date(date1, format) date2 - as.Date(date2, format) idx - date1 DF[[1]] DF[[1]] date2 aggregate(DF[idx, 3], DF[idx, 1:2], FUN = sum) } Hope this helps, Rui Barradas Em

Re: [R] Name assignment in for loop

2012-11-10 Thread nrm2010
Thank you, Bert and Peter, for helpful responses. I'm having a little trouble with Bert's approach because writing the lapply function is challenging when I'm drawing from two dataframes. Peter's approach works perfectly, although it has less R personality. Wrapping the model statement in

[R] sample mean, variance and SD

2012-11-10 Thread parvez_200207
hi could you help me to solve this issue Question: Using command rweibull(100,8,15), simulate n = 100 realizations from Weibull(8; 15) distribution. Using the simulated sample, compute the sample mean, variance and standard deviation of these observations. I am trying like this

Re: [R] help on date dataset

2012-11-10 Thread arun
HI Rui, For some reason, I am not getting the result as expected. date1 #[1] 24/04/2009  date2 #[1] 27/04/2009   extraction(dat,date1,date2,format=%Y-%m-%d) #[1] DATE PAYS x   #0 rows (or 0-length row.names) #Warning messages: #1: In extraction(dat, date1, date2, format = %Y-%m-%d) :  #

Re: [R] sample mean, variance and SD

2012-11-10 Thread Sarah Goslee
This is not a homework help list. On Saturday, November 10, 2012, parvez_200207 wrote: hi could you help me to solve this issue Question: Using command rweibull(100,8,15), simulate n = 100 realizations from Weibull(8; 15) distribution. Using the simulated sample, compute the sample mean,

Re: [R] help on date dataset

2012-11-10 Thread Rui Barradas
Hello, Arun, you're using the wrong format, %Y-%m-%d is the default, with 24/04/2009 you must use extraction(dat, date1, date2, format = %d/%m/%Y) #DATEPAYS x #1 2009-04-26 Mexique 18 #2 2009-04-26 usa 100 Rui Barradas Em 10-11-2012 18:26, arun escreveu: HI Rui, For

[R] matrix of all difference between rows values

2012-11-10 Thread cleberchaves
Hello all, i would like to calculate the difference of all row values and the others row values from my matrix (table 1). The output (table 2) would be a matrix with input matrix's row names on row names and colums names, thereby the difference values among two of the row names could be bether

Re: [R] matrix of all difference between rows values

2012-11-10 Thread cleberchaves
Thank you very much, arun kirshna! That's it! I only modified the res1-apply(toeplitz(dat1[,2]),1,function(x) 10-x) for res1-apply(toeplitz(dat1[,2]),1,function(x) dat1[1,2]-x) and worked very well! Thanks again! -- View this message in context:

Re: [R] help on date dataset

2012-11-10 Thread Rui Barradas
Ok, I've coerced DATE to class Date before running the function: dat$DATE - as.Date(dat$DATE, format = %d/%m/%Y) Without it the function would be: extraction - function(DF, date1, date2, format = %Y-%m-%d){ date - as.Date(DF[[1]], format) date1 - as.Date(date1, format) date2 -

Re: [R] matrix of all difference between rows values

2012-11-10 Thread Rui Barradas
Hello, Try the following. # Create the dataset Table1 - matrix(10:6, ncol = 1) rownames(Table1) - letters[1:5] Table1 t(outer(Table1[,1], Table1[,1], `-`)) Hope this helps, Rui Barradas Em 10-11-2012 18:32, cleberchaves escreveu: Hello all, i would like to calculate the difference of all

Re: [R] sample mean, variance and SD

2012-11-10 Thread Greg Snow
Your code works for me, can you tell us what output you are getting, what output you expect to see, and how they differ? On Sat, Nov 10, 2012 at 11:23 AM, parvez_200207 parvez.r...@uef.fi wrote: hi could you help me to solve this issue Question: Using command rweibull(100,8,15), simulate n

[R] vectorized uni-root?

2012-11-10 Thread U30A J C Nash
The package rootoned on http://r-forge.r-project.org/R/?group_id=395 has an all-R version of zeroin (the algorithm of uniroot). This should also be in Rmpfr by Martin M., as it was set up for that use. I suspect it can be vectorized fairly easily. However, it may be simpler to write, or else

Re: [R] sample mean, variance and SD

2012-11-10 Thread Greg Snow
This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the not a homework help list issue? Now if someone just states the HW question, gives no indication that they have done anything to try to solve it themselves, and expects us to give

Re: [R] sample mean, variance and SD

2012-11-10 Thread Berend Hasselman
On 10-11-2012, at 21:09, Greg Snow wrote: This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the not a homework help list issue? Probably. Now if someone just states the HW question, gives no indication that they have done

Re: [R] sample mean, variance and SD

2012-11-10 Thread Berend Hasselman
On 10-11-2012, at 19:23, parvez_200207 wrote: hi could you help me to solve this issue Question: Using command rweibull(100,8,15), simulate n = 100 realizations from Weibull(8; 15) distribution. Using the simulated sample, compute the sample mean, variance and standard deviation of these

Re: [R] sample mean, variance and SD

2012-11-10 Thread Sarah Goslee
I agree with much of what you said. If there is a reasonable effort to have read the documention or otherwise to have solved the problem on their own, and a clear question, I will frequently at least give a hint or a pointer toward a relevant function or two. Also, I wouldn't consider that the

Re: [R] sample mean, variance and SD

2012-11-10 Thread Jeff Newmiller
It is not always easy to discern what the instructor wants a student to get out of an assignment. Therefore, I can't see changing the policy as it stands. That said, it is not always easy to discern homework from self-study, and sometimes when the question is well-constructed I don't go out of

Re: [R] problem with package development and older defs earlier in search order

2012-11-10 Thread Martin J Reed
Rolf, Re version control: I use SVN and Git depending on the project I am working on and what others are using. Years ago I used RCS, as you say its great for a local repository (as is Git). The point I was making was not about version control but that others like me might get caught out by

[R] Jian-Feng Mao wants to share new pictures with you

2012-11-10 Thread Jian-Feng Mao
Zoosk Hi , Jian-Feng Mao sent you an invite on Zoosk. [1]View Invite This message was sent by a Zoosk user who entered your email address. If you'd prefer not to receive emails when other people send you emails through Zoosk, [2]click here You have received this message at

[R] Jian-Feng Mao wants to share new pictures with you

2012-11-10 Thread Jian-Feng Mao
Zoosk Hi , Jian-Feng Mao sent you an invite on Zoosk. [1]View Invite This message was sent by a Zoosk user who entered your email address. If you'd prefer not to receive emails when other people send you emails through Zoosk, [2]click here You have received this message at

[R] Likelihood ratio

2012-11-10 Thread bgnumis bgnum
Hi All I have to run multiple stimations and to compute Likelihhod ratio. If I compute ls function with coef and summary I can extract outputs that I need. I am not able to find something similar to log liklihood Can you pease tell me running a ls function x on y how to extract if

Re: [R] help on date dataset

2012-11-10 Thread arun
Thanks, Rui, Got it right:  extraction(dat,date1,date2,format=%d/%m/%Y) #    DATE    PAYS   x #1 26/04/2009 Mexique  18 #2 26/04/2009 usa 100 A.K. - Original Message - From: Rui Barradas ruipbarra...@sapo.pt To: arun smartpink...@yahoo.com; r-help r-help@r-project.org Cc:

Re: [R] matrix of all difference between rows values

2012-11-10 Thread cleberchaves
Mmmm... Actually, Rui Barradas is the right! Arun kirshna, yours script has an error. That repeat the same set of numbers in all columns... Anyway, thanks for both! -- View this message in context:

Re: [R] help on date dataset

2012-11-10 Thread anoumou
Rui and ,arun thanks you so much. as i am a beginner, i am on that subject since two days. Thanks,thanks so much. It works !!! -- View this message in context: http://r.789695.n4.nabble.com/help-on-date-dataset-tp4649175p4649203.html Sent from the R help mailing list archive at

Re: [R] matrix of all difference between rows values

2012-11-10 Thread arun
HI, No problem. You can also use ?aaply() from library(plyr) dat1-read.table(text=  a 10 b 9 c 8 d 7 e 6 ,sep=,header=FALSE,stringsAsFactors=FALSE) library(plyr) res1-aaply(dat1[1,2],1,-,toeplitz(dat1[,2]))  

Re: [R] test for a condition in a vector for loop not working

2012-11-10 Thread scoyoc
Once again, thanks! MVS - MVS = Matthew Van Scoyoc Graduate Research Assistant, Ecology Wildland Resources Department Ecology Center Quinney College of Natural Resources Utah State University Logan, UT = Think SNOW! -- View this message in context:

Re: [R] Likelihood ratio

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 11:57 AM, bgnumis bgnum wrote: Hi All I have to run multiple stimations and to compute Likelihhod ratio. If I compute ls function with coef and summary I can extract outputs that I need. Do you mean lm? I am not able to find something similar to log

[R] help with for loop to test for a condition in a vector

2012-11-10 Thread scoyoc
I want my for loop to test for the presence of a term in a vector and return a value to a new vector. I'm not writing it correctly though. Here's what I have... testfor = letters[1:5] x = c(a, b, e, f, g) result = rep(NA, length(testfor)) for (i in testfor){ + v = any(x == testfor[i]) +

[R] For loop question

2012-11-10 Thread dae
I have this code: IEF - to.monthly(IEF, indexAt=endof) SPY - to.monthly(SPY, indexAt=endof) I would like to use a for loop instead of separate entries, so the only code that needs to be modified is the list of symbols. symbols - c(IEF, SPY) for(symbol in symbols) { symbol -

Re: [R] help with for loop to test for a condition in a vector

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 2:07 PM, scoyoc wrote: I want my for loop to test for the presence of a term in a vector and return a value to a new vector. I'm not writing it correctly though. Here's what I have... testfor = letters[1:5] x = c(a, b, e, f, g) result = rep(NA, length(testfor)) for

Re: [R] For loop question

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 2:36 PM, dae wrote: I have this code: IEF - to.monthly(IEF, indexAt=endof) SPY - to.monthly(SPY, indexAt=endof) I would like to use a for loop instead of separate entries, so the only code that needs to be modified is the list of symbols. symbols - c(IEF, SPY)

Re: [R] matrix of all difference between rows values

2012-11-10 Thread arun
Hi, Though the results from Rui, and me are similar, may be it differs in other instances. My result:  dat1-read.table(text=  a 10 b 9 c 8 d 7 e 6 ,sep=,header=FALSE,stringsAsFactors=FALSE)  

Re: [R] sample mean, variance and SD

2012-11-10 Thread Jim Lemon
On 11/11/2012 07:09 AM, Greg Snow wrote: This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the not a homework help list issue? ... As usual, a thoughtful comment on a problem that does not have a straightforward solution. The

[R] maximum likelihood estimation in R

2012-11-10 Thread mmosalman
I want to find ML estimates of a model using mle2 in bbmle package. When I insert new parameters (for new covariates) in model the log-likelihood value does not change and the estimated value is exactly the initial value that I determined. What's the problem? This is the code and the result: As

Re: [R] For loop question

2012-11-10 Thread dae
Thanks. That got me the answer. This works: symbols = c(IEF,SPY) getSymbols(symbols) for(symbol in symbols) { assign(symbol, to.monthly(get(symbol), indexAt=endof)) } #end -- View this message in context:

[R] Plotting the regression curve with its confidence interval

2012-11-10 Thread Осипов Денис
Hello. How can I plot the regression curve with its confidence interval? I use nls(y~a*x^b), then plot(x,y), add curve with lines(x,predict(nls(y~a*x^b))). But I can't add to plot CI for my curve. Thanks in advance, Denis [[alternative HTML version deleted]]

Re: [R] sample mean, variance and SD

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 6:58 PM, Jim Lemon wrote: On 11/11/2012 07:09 AM, Greg Snow wrote: This is to all R-helpers (Sarah is just the one that I am replying to), Have we become a little too draconian on the not a homework help list issue? ... As usual, a thoughtful comment on a problem

Re: [R] For loop question

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 10:17 PM, dae wrote: Thanks. That got me the answer. Good. That's what the FAQ is for. You should also read the Posting Guide where the reasons behind the request to include context for replies is laid out. This works: symbols = c(IEF,SPY) getSymbols(symbols)

Re: [R] Plotting the regression curve with its confidence interval

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 9:36 PM, Осипов Денис wrote: Hello. How can I plot the regression curve with its confidence interval? I use nls(y~a*x^b), then plot(x,y), add curve with lines(x,predict(nls(y~a*x^b))). But I can't add to plot CI for my curve. Have your read: ?predict.nls # ? --

Re: [R] maximum likelihood estimation in R

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 9:22 PM, mmosalman wrote: I want to find ML estimates of a model using mle2 in bbmle package. When I insert new parameters (for new covariates) in model the log-likelihood value does not change and the estimated value is exactly the initial value that I determined. What's

Re: [R] Plotting the regression curve with its confidence interval

2012-11-10 Thread Jim Lemon
On 11/11/2012 04:36 PM, Осипов Денис wrote: Hello. How can I plot the regression curve with its confidence interval? I use nls(y~a*x^b), then plot(x,y), add curve with lines(x,predict(nls(y~a*x^b))). But I can't add to plot CI for my curve. Hi Denis, If you know where you want the lines for

Re: [R] Plotting the regression curve with its confidence interval

2012-11-10 Thread Осипов Денис
Yes, but it says that arguments, that could help me, now isn't implemented. Hello. How can I plot the regression curve with its confidence interval? I use nls(y~a*x^b), then plot(x,y), add curve with lines(x,predict(nls(y~a*x^b))). But I can't add to plot CI for my curve. Have your read:

Re: [R] Plotting the regression curve with its confidence interval

2012-11-10 Thread David Winsemius
On Nov 10, 2012, at 11:48 PM, Осипов Денис wrote: Yes, but it says that arguments, that could help me, now isn't implemented. I think the authors might have had their reasons for leaving it out. There have been quite a few threads ofver the years discussing why it is not a straightforward