[R] Date conversion problem using as.Date

2005-03-18 Thread Vegard Andersen
Hello! My problem is that the Julian date behind my dates seems to be wrong. I will examplify my problem. t1 - 1998-11-20 t2 - as.Date(t1) # Here t2 is correctly 1998-11-20, but date.mdy(t2) $month [1] 11 $day [1] 19 $year [1] 1988 And indeed, if I write: fix(t2) then I get : structure(10550,

[R] multiple graphs

2005-03-18 Thread Moor MHM.de
Dear all, I would like to plot multiple graphs in the same window. For this I used: par(mfcol=c(5,2) ) and then I use plot(x,y) to fill the cells of the window with the graphs. This results in multiple graphs with a lot of space around each graph. But I would like the 5 graphs in

[R] creating functions in R

2005-03-18 Thread Oarabile Ruth Molaodi
I am trying to learn how to create my own function in R. I want to create a function that can plot the polygons/regions/map given the coordinates of each region. The function should be able to colour the poplygons according to the data supplied ,for examples the means or rates of disease at a

Re: [R] multiple graphs

2005-03-18 Thread Uwe Ligges
Moor MHM.de wrote: Dear all, I would like to plot multiple graphs in the same window. For this I used: par(mfcol=c(5,2) ) and then I use plot(x,y) to fill the cells of the window with the graphs. This results in multiple graphs with a lot of space around each graph. But I would like

Re: [R] Optimization of constrained linear least-squares problem

2005-03-18 Thread Stefaan Lhermitte
Thanx Dimitris, Patrick and Berwin! For other people interested in this problem, here are two valid solutions that work. 1) Re-parameterize e.g., EM - c(100,0,0,0,100,0,0,0,100) W - array(EM, c(3,3)) d - c(10, 20, 70) fn - function(x){ x - exp(x) / sum(exp(x)) r -

Re: [R] creating functions in R

2005-03-18 Thread Uwe Ligges
Oarabile Ruth Molaodi wrote: I am trying to learn how to create my own function in R. I want to create a function that can plot the polygons/regions/map given the coordinates of each region. The function should be able to colour the poplygons according to the data supplied ,for examples the

[R] passing arguments to FUN in lapply

2005-03-18 Thread Pingping Zheng
Suppose I have a nx2 matrix of data, X, the following code generate density estimation for each column and plot them denlist - apply(X, 2, density) par(mfrow=c(1,2)) lapply(denlist, plot) Does anyone know how to change the main title of each density plot to var 1, var 2 by passing optional

Re: [R] creating functions in R

2005-03-18 Thread Roger Bivand
On Fri, 18 Mar 2005, Uwe Ligges wrote: Oarabile Ruth Molaodi wrote: I am trying to learn how to create my own function in R. I want to create a function that can plot the polygons/regions/map given the coordinates of each region. The function should be able to colour the poplygons

Re: [R] passing arguments to FUN in lapply

2005-03-18 Thread Uwe Ligges
Pingping Zheng wrote: Suppose I have a nx2 matrix of data, X, the following code generate density estimation for each column and plot them denlist - apply(X, 2, density) par(mfrow=c(1,2)) lapply(denlist, plot) Does anyone know how to change the main title of each density plot to var 1, var 2 by

Re: [R] Installation problem MacOS X

2005-03-18 Thread joerg van den hoff
Hector L. Ayala-del-Rio wrote: R gurus I have tried to install the R 2.0.1 binary for OS X and although the installation was successful I can get the application going. When I double click the icon R tries to load (R window shows briefly) and it quits immediately. This behavior was

Re: [R] Constrained Nelder-Mead

2005-03-18 Thread Adrian Trapletti
All, In looking at `optim', it doesn't appear that it is possible to impose nonlinear constraints on Nelder- Mead. I am sufficiently motivated to try to code something in C from scratch and try to call it from R Does anyone have some good references to barrier and/or penalization methods

[R] RE: problem with Dates

2005-03-18 Thread Benjamin Esterni
It seems that you have load the survival package date.mdy is a function from this one. In this function the origin of the time is the first day of 1970 in the base package the origin is the first day of 1960 it's very curious... Benjamin Esterni France From: Vegard Andersen [EMAIL PROTECTED]

Re: [R] passing arguments to FUN in lapply

2005-03-18 Thread Gabor Grothendieck
Pingping Zheng pingping.zheng at lancaster.ac.uk writes: : : Suppose I have a nx2 matrix of data, X, the following code generate : density estimation for each column and plot them : : denlist - apply(X, 2, density) : par(mfrow=c(1,2)) : lapply(denlist, plot) : : Does anyone know how to change

[R] Changing label size in plot.dendrogram

2005-03-18 Thread michael schmitt
Dear R friends, I have constructed an object of class 'dendrogram' using an own function, and I'm using the R function plot.dendrogram for visualizing it. It works fine, but I could not find out how to change the font size of edge and leaf labels. ?plot.dendrogram has shown me that the coloring

Re: [R] passing arguments to FUN in lapply

2005-03-18 Thread Adaikalavan Ramasamy
See Andy Liaw's and my suggestion to this post http://files.protsuggest.org/biocond/html/7818.html On Fri, 2005-03-18 at 11:40 +, Pingping Zheng wrote: Suppose I have a nx2 matrix of data, X, the following code generate density estimation for each column and plot them denlist - apply(X,

[R] Non linear modeling

2005-03-18 Thread Angelo Secchi
Hi, is there a way in R to fit a non linear model like y=x+exp(a*x)*eps where a is the parameter and eps is the error term? Thanks Angelo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Date conversion problem using as.Date

2005-03-18 Thread Gabor Grothendieck
Vegard Andersen vegard.andersen at ism.uit.no writes: : : Hello! : : My problem is that the Julian date behind my dates seems to be wrong. I : will examplify my problem. : : t1 - 1998-11-20 : t2 - as.Date(t1) : # Here t2 is correctly 1998-11-20, but : date.mdy(t2) : $month : [1] 11 : $day :

RE: [R] Non linear modeling

2005-03-18 Thread Liaw, Andy
AFAIK most model fitting techniques will only deal with additive errors, not multiplicative ones. You might want to try fitting: log(y-x) = a*x + e which is linear. Andy From: Angelo Secchi Hi, is there a way in R to fit a non linear model like y=x+exp(a*x)*eps where a is the

[R] Re: non-linear model

2005-03-18 Thread Guillaume STORCHI
if a and eps are parameters to be fitted X-nls(y~x+exp(a*x)*eps, data=,start=list(a=,eps=)) Découvrez nos promotions exclusives destination de la Tunisie, du Maroc, des Baléares et la Rép. Dominicaine sur Yahoo! Voyages :

Re: [R] Ideal Computer and Software (A bit off topic)

2005-03-18 Thread Don MacQueen
I'd like to mention that if using the desktop applications such as MS Word, Excel, Powerpoint, email software, Acrobat Reader, etc. is important to you, then the Mac may be a better choice than a Linux box. Mac OS X lets you use all of those, and also work at the unix level, side by side and

Re: [R] RE: problem with Dates

2005-03-18 Thread Thomas Lumley
On Fri, 18 Mar 2005, Benjamin Esterni wrote: It seems that you have load the survival package date.mdy is a function from this one. In this function the origin of the time is the first day of 1970 in the base package the origin is the first day of 1960 it's very curious... Well, it would be very

Re: [R] Installation problem MacOS X

2005-03-18 Thread Rob J Goedman
Hector, By application, you mean R or the R + GUI (R.app)? Please check if you have an existing .RData file in the directory where you start R. If it's R.app and X11 was used when .RData was saved, X11 needs to run when the restore takes place. Mac OS issues might be better raised on R-SIG-Mac

[R] slow computation of mixed ANOVA using aov

2005-03-18 Thread Steven Lacey
Dear R-help list, I am trying to do a mixed ANOVA on a 8960 x 5 dataframe. I have 3 factors for which I want to test all main effects and interactions : f1 (40 levels), f2 (7 levels), and f3 (4 levels). I also have a subject factor, subject, and a dependent variable, dv. Some more information

Re: [R] Non linear modeling

2005-03-18 Thread ronggui
then is the nls function can deal the problem as Guillaume STORCHI mentioned in the last post? [X-nls(y~x+exp(a*x)*eps, data=,start=list(a=,eps=))] or just can solve the problem as:log(y-x) = a*x + e? On Fri, 18 Mar 2005 08:56:38 -0500 Liaw, Andy [EMAIL PROTECTED] wrote: AFAIK most model

RE: [R] Non linear modeling

2005-03-18 Thread Liaw, Andy
That's treating eps as a parameter in the model. If I read your question right, that's not what you want. Andy From: ronggui [mailto:[EMAIL PROTECTED] then is the nls function can deal the problem as Guillaume STORCHI mentioned in the last post? [X-nls(y~x+exp(a*x)*eps,

RE: [R] How to create a 'fit' plot

2005-03-18 Thread Ted Harding
On 18-Mar-05 R_xprt_wannabe wrote: Dear List, As someone who is in the process of trying to migrate from Excel, I'd appreciate any help on this question: I have a data set and want to fit, say, three distributions to it. I would like to create a plot that shows my data points against

Re: [R] glm - poisson

2005-03-18 Thread ronggui
i think that is ok. when a response count n(i) has index equal to t(i),the sample rate is n(i)/t(i),its expected value is u(i)/t(i)..a loglinear model for theexpeted rate has form log(u(i)/t(i))=a+bx(agresti,2002) this model can use glm-poisson with a offset term to estimate On Thu, 17 Mar

[R] Bivariate normal distribution and correlation

2005-03-18 Thread Pekka Vimpari
Suppose I know the value of cumulative bivariate standard normal distribution. How can I solve correlation between variables? Pekka - [[alternative HTML version deleted]] __

[R] Pb with ks.test pvalue

2005-03-18 Thread Anthony Landrevie
Hello, While doing test of normality under R and SAS, in order to prove the efficiency of R to my company, I notice that Anderson Darling, Cramer Van Mises and Shapiro-Wilk tests results are quite the same under the two environnements, but the Kolmogorov-smirnov p-value really is different.

[R] lme user-defined correlation structures??

2005-03-18 Thread Michael Jerosch-Herold
Could somebody help with the definition of new correlation structure for use with a linear mixed-effects model (package nlme). Specifically, I want to define a Toeplitz type correlation structure, but due to my inexperience with programming in R, I feel a bit overwhelmed with the task at hand.

[R] How to show which variables include in plot of classification tree

2005-03-18 Thread Muhammad Subianto
Dear all For my research, I am learning classification now. I was trying some example about classification tree pakages, such as tree and rpart, for instance, in Pima.te dataset have 8 variables (include class=type): library(rpart) library(datasets) pima.rpart - rpart(type ~

RE: [R] extract rows in dataframe with duplicated column values

2005-03-18 Thread Tiago R Magalhaes
Thank you very much to Andy Liaw, Rob J Goedman and Marc Schwartz for taking their time to solve my problem. I've learned in many other occasions from useful tips coming from all 3 of them and it just happened once again. You got to love this mailing list... subset(x, a %in% a[duplicated(a)])

RE: [R] Basic questions about RMySQL

2005-03-18 Thread bogdan romocea
1. No way. You must have MySQL installed on your computer. In fact this is not true. You can use a MySQL server installed somewhere else on the network. --- bogdan romocea [EMAIL PROTECTED] wrote: 1. No way. You must have MySQL installed on your computer. 2. You must install the server.

Re: [R] How to show which variables include in plot of classification tree

2005-03-18 Thread Uwe Ligges
Muhammad Subianto wrote: Dear all For my research, I am learning classification now. I was trying some example about classification tree pakages, such as tree and rpart, for instance, in Pima.te dataset have 8 variables (include class=type): library(rpart) library(datasets) pima.rpart -

Re: [R] Non linear modeling

2005-03-18 Thread Angelo Secchi
You are right. eps in my model is not a parameter but the error term. Also the linearization doesn't solve the problem, since sometimes you cannot take logs. Any other ideas? Thanks On Fri, 18 Mar 2005 11:21:12 -0500 Liaw, Andy [EMAIL PROTECTED] wrote: That's treating eps as a parameter in

Re: [R] Basic questions about RMySQL

2005-03-18 Thread bogdan romocea
I certainly can't; I initially misunderstood the question. If connecting to MySQL is the problem, then you need to know the user ID, the domain and the password. Ask your DB administrator for help. Here's an example that works for me (local MySQL installation): require(DBI) require(RMySQL)

RE: [R] Basic questions about RMySQL

2005-03-18 Thread De la Vega Góngora Jorge
Thanks for your help. having MySQL server locally (or in some other place) should solve the configuration problem. By the way, I should have written forgive, no forget. Forgive me. Jorge de la Vega -Mensaje original- De: bogdan romocea [mailto:[EMAIL PROTECTED] Enviado el:

Re: [R] Non linear modeling

2005-03-18 Thread Spencer Graves
What do you want to minimize? Can you write a function to compute eps given x, y, and a? Given that, you can then write another function to compute the objective function you want to minimize. If a is a scalar, compute the objective function for a range of values of a and plot. If you

Re: [R] Bivariate normal distribution and correlation

2005-03-18 Thread Spencer Graves
How about the following: Suppose you have the bivariate cumulative distribution function (cdf) for (X, Y). 1. From this first compute the marginal cdf for X. The median will give you EX, and you can get sigmaX = IQR/(2*qnorm(0.75)), where IQR = interquartile range =

Re: [R] How to create a 'fit' plot

2005-03-18 Thread Adaikalavan Ramasamy
If you know the exact formulae for the distribution, replace it with 'f' function below. You may want to use the log=x in the plot. f - function(x) 1 - exp( -x/20 ); plot( f, xlim=c(0,100), ylim=c(0.5, 1) ) Otherwise generate sufficient realisations from it and fit a line as below x -

[R] Hmisc latex

2005-03-18 Thread Michaell Taylor
Hmisc includes a latex function which typesets objects in latex. A great time saver. I am using it to create a large number of tables in a loop in conjuction with prettyNum to place '000s separators in the numbers (i.e. 1,000,000 not 100). This converts the numbers to strings. The

Re: [R] Quantiles of data in a contingency table

2005-03-18 Thread Matt Mohebbi
On Thu, 17 Mar 2005 10:29:16 +0200, Markus Jäntti [EMAIL PROTECTED] wrote: Matt Mohebbi wrote: Hello, I have data of the following form: data - data.frame(type=c(c,d,e), size=c(10,20,30), count=c(20,10,5)) data type size count 1c 1020 2d 2010 3e

Re: [R] Basic questions about RMySQL

2005-03-18 Thread Kjetil Brinchmann Halvorsen
De la Vega Góngora Jorge wrote: Hello, Please forget me if I am asking something that is well documented. I have read documentation but there are points that are not clear for me. I am not expert in R nor Databases, but if someone direct me to a tutorial, I will appreciate it.. 1. In my

[R] Is there such a function that can sort a table according to one column?

2005-03-18 Thread Terry Mu
when I sort one column, other columns will change with it. otherwise, I can get index from sort() and write a function. Better idea? Thanks, __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

[R] Is a .R script file name available inside the script?

2005-03-18 Thread Darren Weber
Hi, if we have a file called Rscript.R that contains the following, for example: x - 1:100 outfile = Rscript.Rout sink(outfile) print(x) and then we run source(Rscript.R) we get an output file called Rscript.Rout - great! Is there an internal variable, something like .Platform, that holds

[R] plotmath question

2005-03-18 Thread Berton Gunter
R listers: I have been foiled by plotmath! (in R 2.01,Windows 2000) The task: Plot a normal density and label the ticks as mu - 3 sigma, mu - 2 sigma, , mu + 3 sigma, where the mu's and sigmas appear as Greek symbols, of course. The following code does this: x-seq(-3,to=3,by=.01)

RE: [R] Is there such a function that can sort a table according to one column?

2005-03-18 Thread Liaw, Andy
See ?order, which is pointed to in the `See Also' section of ?sort. Andy From: Terry Mu when I sort one column, other columns will change with it. otherwise, I can get index from sort() and write a function. Better idea? Thanks, __

[R] Sweave/margin

2005-03-18 Thread Katharina Hoff
Hi! I am currently using Sweave for writing my bachelor thesis - and I have a problem: I am using a LaTeX style (report) with quite big margin spaces. The Sweave generated LaTeX code floats into the margin - and it looks ugly. The text is blocked and fine... then there comes some flattering code

RE: [R] Sweave/margin

2005-03-18 Thread Doran, Harold
Try a code chunk like this: echo=FALSE= options(width = 70) @ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Katharina Hoff Sent: Friday, March 18, 2005 4:50 PM To: r-help@stat.math.ethz.ch Subject: [R] Sweave/margin Hi! I am currently using Sweave

Re: [R] plotmath question

2005-03-18 Thread apjaworski
Bert, This works fine and and seems a little simpler: x-seq(-3,to=3,by=.01) y-dnorm(x) plot(x,y,type='h',col='lightblue',axes=FALSE) lines(x,y,col='darkblue') axis(2) ll - expression(mu-3*sigma, mu-2*sigma, mu-sigma, mu, mu+sigma, mu+2*sigma, mu+3*sigma) axis(1, at=-3:3, lab=ll) box()

Re: [R] Sweave/margin

2005-03-18 Thread Deepayan Sarkar
On Friday 18 March 2005 15:49, Katharina Hoff wrote: Hi! I am currently using Sweave for writing my bachelor thesis - and I have a problem: I am using a LaTeX style (report) with quite big margin spaces. The Sweave generated LaTeX code floats into the margin - and it looks ugly. The text

Re: [R] plotmath question

2005-03-18 Thread Deepayan Sarkar
On Friday 18 March 2005 15:41, Berton Gunter wrote: R listers: I have been foiled by plotmath! (in R 2.01,Windows 2000) The task: Plot a normal density and label the ticks as mu - 3 sigma, mu - 2 sigma, , mu + 3 sigma, where the mu's and sigmas appear as Greek symbols, of course.

[R] Count all dataset

2005-03-18 Thread Jan Sabee
Dear all R member, I have a dataset which looks like: x1 x2 . . . x250 A A C A C C A A A A ANA B B B NA C B ... more 2000 rows. I need count all dataset at the following: A = sum of A B =

Re: [R] Non linear modeling

2005-03-18 Thread Christian Ritz
Hi Angelo, have a look at the following example which uses 'gls' in the nlme package. library(nlme) x - runif(100, 0, 1) y - x + exp(4*x)*rnorm(100, 0, 2) gls(y~x, correlation = varExp(form=~x)) For details see ?gls and ?varExp. Christian __

Re: [R] plotmath question

2005-03-18 Thread Thomas Lumley
On Fri, 18 Mar 2005, Berton Gunter wrote: 2) The plotmath Help state that expressions can be used for axis labels, so I would have expected the above to work without the eval()call -- but it does not. Would someone kindly explain to me why not -- i.e., what I have misunderstood. That is, to be

[R] Re: Repeated Measures, groupedData and lme

2005-03-18 Thread Keith Wong
Hello, I'm an R-newbie, but I've been learning to use lme for repeated measures experiments as well. If I understand correctly: Outcome variable: Mg (Kg/ha) Subject/grouping variable: block Condition/treatment: treatment (19 levels) Repeated factor: time (3 levels: 99, 02, 04) I

RE: [R] Count all dataset

2005-03-18 Thread Liaw, Andy
Here are two (pretty much the same) ways: d x1 x2 x3 1 D DA 2 B DA 3 C A NA 4 D DA 5 A DC table(sapply(d, as.character)) A B C D 5 1 2 6 table(as.matrix(d)) A B C D 5 1 2 6 sum(is.na(d)) [1] 1 HTH, Andy From: Jan Sabee Dear all R member, I have a

Re: [R] Is a .R script file name available inside the script?

2005-03-18 Thread Gabor Grothendieck
Darren Weber darrenleeweber at gmail.com writes: : : Hi, : : if we have a file called Rscript.R that contains the following, for example: : : x - 1:100 : outfile = Rscript.Rout : sink(outfile) : print(x) : : and then we run : : source(Rscript.R) : : we get an output file called

[R] the number of cluster

2005-03-18 Thread XP Sun
hi, all, how to decide the number of cluster before you use kmeans and hclust? thank you in advance! best -xpsun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!