[R] How to obtain parameters of a mixture model of two lognormal distributions

2007-09-07 Thread Jacques Wagnor
Dear List, I have read that a lognormal mixture model having a pdf of the form f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1 and f2 are lognormal distributions. Any pointers on how to create a function that would produce the 5 parameters of f(x) would be greatly

Re: [R] How to obtain parameters of a mixture model of two lognormal distributions

2007-09-07 Thread Charles C. Berry
On Fri, 7 Sep 2007, Jacques Wagnor wrote: Dear List, I have read that a lognormal mixture model having a pdf of the form f(x)=w1*f1(x)+(1-w1)*f2(x) fits most data sets quite well, where f1 and f2 are lognormal distributions. Whoa! There have to be a lot of qualifiers on an assertion like

[R] How to do ANOVA with fractional values and overcome the error: Error in `storage.mode-`(`*tmp*`, value = double) : invalid to change the storage mode of a factor

2007-09-06 Thread Emre Sevinc
I have exported a CSV file from my EXCEL worksheet and its last column contained decimal values: Subject;Group;Side;Difference;PercentError M3;1;1;; M5;1;1;375;18,75 M8;1;1;250;14,58 M10;1;1;500;12,50 M12;1;1;375;25,00 . . . When I tried to do ANOVA test on it, R complained by givin error:

Re: [R] How to do ANOVA with fractional values and overcome the error: Error in `storage.mode-`(`*tmp*`, value = double) : invalid to change the storage mode of a factor

2007-09-06 Thread Prof Brian Ripley
Your data file has commas as the decimal point. Use read.csv2 for such files. What happened was that PercentError was read as a factor, and you can't do ANOVA on factors. The warning In addition: Warning message: using type=numeric with a factor response will be ignored in:

Re: [R] How to do ANOVA with fractional values and overcome the

2007-09-06 Thread Ted Harding
On 06-Sep-07 06:55:36, Emre Sevinc wrote: I have exported a CSV file from my EXCEL worksheet and its last column contained decimal values: Subject;Group;Side;Difference;PercentError M3;1;1;; M5;1;1;375;18,75 M8;1;1;250;14,58 M10;1;1;500;12,50 M12;1;1;375;25,00 . . . When I tried

Re: [R] how to extract t-test statistics from glm()?

2007-09-06 Thread Uwe Ligges
Bin Sun wrote: I need to extract t-test statistics from glm(). For example, Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 46.219911.6310 3.974 0.000106 *** Var1 1.0440 0.5948 1.755 0.081088 . Var2 -0.4717

[R] How to extract part of an array?

2007-09-05 Thread Lauri Nikkinen
Hi, How can I extract part of an array? I would like to extract table Supported from this array. If this is not possible, how do I convert array to list? I'm sorry this is not an reproducible example. spl - tapply(temp$var1, list(temp$var2, temp$var3, temp$var3), mean) spl , , Supported

Re: [R] How to extract part of an array?

2007-09-05 Thread Peter Dalgaard
Lauri Nikkinen wrote: Hi, How can I extract part of an array? I would like to extract table Supported from this array. If this is not possible, how do I convert array to list? I'm sorry this is not an reproducible example. spl - tapply(temp$var1, list(temp$var2, temp$var3, temp$var3),

Re: [R] How to obtain intercept statistics in anova withwithin-subject factors?

2007-09-05 Thread Greg Snow
] On Behalf Of Sid Kouider Sent: Friday, August 31, 2007 3:19 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] How to obtain intercept statistics in anova withwithin-subject factors? Dear Greg, Thanks very much for you advice. Unfortunately, although summary.lm applied on aov objects indeed

[R] how to do interpolation

2007-09-04 Thread Yogesh Tiwari
Hello R Users, How to make a variable equidistance with time i.e. how to interpolate a variable if it is not sampled at equal time interval. Many thanks, Regards, Yogesh [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch

Re: [R] how to do interpolation

2007-09-04 Thread Jared O'Connell
Use approx() if you just want linear interpolation. On 9/4/07, Yogesh Tiwari [EMAIL PROTECTED] wrote: Hello R Users, How to make a variable equidistance with time i.e. how to interpolate a variable if it is not sampled at equal time interval. Many thanks, Regards, Yogesh

Re: [R] how to do interpolation

2007-09-04 Thread Jim Lemon
Yogesh Tiwari wrote: Hello R Users, How to make a variable equidistance with time i.e. how to interpolate a variable if it is not sampled at equal time interval. Hi Yogesh, Don't know whether this will suit your purpose. I wrote it to enable color-coded plotting of highly variable data. If

Re: [R] how to do interpolation

2007-09-04 Thread gyadav
Keep in touch and keep mailing :-) slow or fast, little or too much Yogesh Tiwari [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 09/04/2007 04:04 PM To r-help@stat.math.ethz.ch cc Subject [R] how to do interpolation Hello R Users, How to make a variable equidistance with time i.e

[R] how to extract t-test statistics from glm()?

2007-09-04 Thread Bin Sun
I need to extract t-test statistics from glm(). For example, Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 46.219911.6310 3.974 0.000106 *** Var1 1.0440 0.5948 1.755 0.081088 . Var2 -0.4717 2.0257 -0.233 0.816178

[R] how to sub-sample a variable on another file coordinates

2007-09-03 Thread Yogesh Tiwari
Hello 'R' Users, I have a monthly mean CO2 necdf data file defined on 1x1 lat by lon coordinate. I want to sub-sample this variable CO2 on the coordinates of another ASCII data file. The coordinates of another ASCII data file are as: -24.01 152.06 -18.58 150.19 -13.46 148.35 -8.29 147.03

Re: [R] how to sub-sample a variable on another file coordinates

2007-09-03 Thread Paul Hiemstra
Dear Yogesh, This question seems more appropriate for the r-sig-geo mailing list (https://stat.ethz.ch/mailman/listinfo/r-sig-geo). The sampling of the netcdf files can be done by using the overlay function from the sp-package (available on CRAN). You would have to read both the netcdf file

[R] how to compute cross correlation

2007-09-03 Thread Yogesh Tiwari
Hello R Users, How to compute cross correlation between two time series. Data is in ASCII format. I am using R on windows. Many thanks, Regards, Yogesh [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

Re: [R] how to compute cross correlation

2007-09-03 Thread Moshe Olshansky
The simlest answer is that X and Y are two vectors of length n then (un-normalized) cross correlation between X and Y is sum(i=1 to n) {X(i)-Xbar)*(Y(i)-Ybar)} where Xbar and Ybar are the means of X and Y respectively. You may need something different, so could you be more specific? What do you

Re: [R] How to measure mode (central tendancy)

2007-08-31 Thread Thomas Petzoldt
Julian Burgos wrote: mode()... of course! Wrong. See ?mode Get or set the type or storage mode of an object. Thomas P. Raymond Balise wrote: What is the name of the function to give me the mode (central tendancy) of a numeric variable that can be negative? [[alternative HTML version

Re: [R] How to obtain intercept statistics in anova with within-subject factors?

2007-08-31 Thread Sid Kouider
Dear Greg, Thanks very much for you advice. Unfortunately, although summary.lm applied on aov objects indeed shows the intercept's statistics, this function does not (seem to) work with within-participant designs. As soon as I enter the info on the error term (see the example in my first

[R] How to signal the end of the table?

2007-08-30 Thread Yuchen Luo
I am using a for loop to read a table row by row and I have to specify how many records are there in the table. I need to read row by row because the table is huge and the memory not large enough for the whole table.: number.of.records=100 fp=file(abc.csv,r) pos=seek(fp, rw=read) for (i in

Re: [R] How to signal the end of the table?

2007-08-30 Thread Uwe Ligges
What about trying to use a database system and make queries? If you are at the end of a file, you will read elements of length 0... Uwe Ligges Yuchen Luo wrote: I am using a for loop to read a table row by row and I have to specify how many records are there in the table. I need to read row

[R] how to calculate weighted means by groups

2007-08-30 Thread Patrick Zimmermann
Hello, I want to calculate the weighted means of a table column, aggregated by other elements of the same table. For example I want to calculate mean species numbers weighted by area and grouped by year, altitude and/or region. I think a combination of aggregate() and weighted.mean() should work,

Re: [R] How to signal the end of the table?

2007-08-30 Thread ONKELINX, Thierry
: woensdag 29 augustus 2007 19:41 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] How to signal the end of the table? I am using a for loop to read a table row by row and I have to specify how many records are there in the table. I need to read row by row because the table is huge and the memory

[R] How to mask or escape =

2007-08-30 Thread Vladimir Eremeev
-- View this message in context: http://www.nabble.com/How-to-mask-or-escape-%22%3D%22-tf4354174.html#a12406926 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list

[R] How to mask or escape = in Windows command prompt?

2007-08-30 Thread Vladimir Eremeev
I have defined a function with several arguments and have it stored in the .RData file. The 'function head' is defined as follows EstimALIConc -function(sdname,SZ,W,farea,watri,biomodel,start.part=1,nparts=20,method=c(optim,DEoptim)) { [ blah-blah-blah ] (function body doesn't matter) }

[R] How to signal the end of the table?

2007-08-30 Thread Monica Pisica
your data.frame afterwards. I work on a Windows machine with 4 Gb DRAM - just for comparison. I hope this helps, Monica Message: 88Date: Wed, 29 Aug 2007 10:41:05 -0700From: Yuchen Luo [EMAIL PROTECTED]Subject: [R] How to signal the end of the table?To: r-help

Re: [R] How to signal the end of the table?

2007-08-30 Thread Vladimir Eremeev
For example, fp-file(abc.csv,r) c.row-scan(file=fp,sep=,,nlines=1) # what argument is omitted for bevity as it doesn't matter rows-c.row while(length(c.row)0) { c.row-scan(file=fp,sep=;,nlines=1); rows-rbind(rows,c.row) } close(fp) If you want to read a file by parts, then you do

[R] How to obtain intercept statistics in anova with within-subject factors?

2007-08-30 Thread Sid Kouider
Dear R users, I am looking for an easy (i.e., direct) way of obtaining the F and p values from the intercept in anovas with within-subject designs. My data are from a psychophysics experiment where I am using d' (d-prime) values obtained from 3 modalities of presentation in each subject. I would

[R] How to measure mode (central tendancy)

2007-08-30 Thread Raymond Balise
What is the name of the function to give me the mode (central tendancy) of a numeric variable that can be negative? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] How to measure mode (central tendancy)

2007-08-30 Thread Thomas Petzoldt
Raymond Balise wrote: What is the name of the function to give me the mode (central tendancy) of a numeric variable that can be negative? Similar questions appear occasionally on this list. Please see the following help page for possible solutions:

Re: [R] How to measure mode (central tendancy)

2007-08-30 Thread Julian Burgos
mode()... of course! Raymond Balise wrote: What is the name of the function to give me the mode (central tendancy) of a numeric variable that can be negative? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

[R] How to let the program know the end of a file is reached?

2007-08-29 Thread Yuchen Luo
Dear collegues. I am using scan( ) to read from a table (a csv file). I am wondering how to let the program know that the end of the file is reached? Your help will be highly appreciated! Best Wishes Yuchen Luo [[alternative HTML version deleted]]

Re: [R] How to let the program know the end of a file is reached?

2007-08-29 Thread Ptit_Bleu
Hi Yuchen, I'm not sure my message will help you but who knows (I'm a newbie : I discovered R one month ago). To load data file, I use donnees-read.table(datafile.dat, quote=\, sep=;, dec=,, skip=18) and I don't need to tell when to stop. R knows it. Good luck, Ptit Bleu. Yuchen Luo wrote:

[R] How to cite the the PDF user's guide for LIMMA

2007-08-29 Thread Vallejo, Roger
Dear All, How to cite the PDF user's guide for the LIMMA package? This is not about how to cite the LIMMA package. Roger Roger L. Vallejo, Ph.D. Computational Biologist Geneticist U.S. Department of Agriculture, ARS National Center for Cool Cold Water Aquaculture 11861 Leetown Road

Re: [R] How to cite the the PDF user's guide for LIMMA

2007-08-29 Thread Vallejo, Roger
, Roger; r-help@stat.math.ethz.ch Subject: Re: [R] How to cite the the PDF user's guide for LIMMA This depends on what style manual you , your publisher, or your institution uses. One common syle (APA ) recommends this: http://library.osu.edu/sites/guides/apagd.php#sid --- Vallejo, Roger

Re: [R] How to cite the the PDF user's guide for LIMMA

2007-08-29 Thread John Kane
This depends on what style manual you , your publisher, or your institution uses. One common syle (APA ) recommends this: http://library.osu.edu/sites/guides/apagd.php#sid --- Vallejo, Roger [EMAIL PROTECTED] wrote: Dear All, How to cite the PDF user's guide for the LIMMA package? This

[R] How to multiply all dataframe rows by another dataframe's columns

2007-08-29 Thread Luke Neraas
Hello, I have two data frames, X and Y, with two columns each and different numbers of rows. # creation of data frame X Loc1.alleles - c(1,5,6,7,8) Loc1.Freq- c(0.35, 0.15, 0.05, 0.10, 0.35) Loc1 - cbind( Loc1.alleles,Loc1.Freq) X- data.frame(Loc1) #creation

Re: [R] How to multiply all dataframe rows by another dataframe's columns

2007-08-29 Thread Anders Nielsen
matrix(Y[,2]%o%X[,2],ncol=1) On Wednesday 29 August 2007 03:21 pm, Luke Neraas wrote: Hello, I have two data frames, X and Y, with two columns each and different numbers of rows. # creation of data frame X Loc1.alleles - c(1,5,6,7,8) Loc1.Freq- c(0.35, 0.15, 0.05,

Re: [R] How to multiply all dataframe rows by another dataframe's columns

2007-08-29 Thread Moshe Olshansky
Below is one way to do this: Loc1.alleles - c(1,5,6,7,8) Loc1.Freq- c(0.35, 0.15, 0.05, 0.10, 0.35) Loc1 - cbind( Loc1.alleles,Loc1.Freq) X- data.frame(Loc1) Loc2.alleles - c(1,4,6,8) Loc2.Freq - c(0.35, 0.35, 0.10, 0.20) Loc2 -

[R] How to find the likelihood function?

2007-08-28 Thread francogrex
Hi, I am writing a BRugs code and I need to specify the likelihood for the gamma distribution and I am specifying it as the pdf: (pow(b1,a1)/(exp(loggam(a1)))*(exp(-b1*lambda[i]))*pow(lambda[i],(a1-1))) But it is not accepting it although I know that I could use the pdf in R to estimate the

[R] how to calculate mean into a list

2007-08-28 Thread Weiwei Shi
Dear Listers: I have this task and suppose a0 is a list of 10 data.frames, I want to calculate like this (a0[[1]]+a0[[2]]+..+a[[10]])/10 Thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III

Re: [R] how to calculate mean into a list

2007-08-28 Thread jim holtman
try: colMeans(do.call('rbind', lapply(a0, mean))) On 8/28/07, Weiwei Shi [EMAIL PROTECTED] wrote: Dear Listers: I have this task and suppose a0 is a list of 10 data.frames, I want to calculate like this (a0[[1]]+a0[[2]]+..+a[[10]])/10 Thanks. -- Weiwei Shi, Ph.D Research Scientist

[R] how to write nicely a condition on a loop for (that is, not like I did)

2007-08-27 Thread Ptit_Bleu
Hi again, This is the follow of my post Problem with save or/and if (I think but maybe not ...). In this post, I wrote that I solved my main problem. And it is true. I also wrote that there was still another problem, which I managed to solve. But I think there must be another way to solve it

[R] How can I interpret this test hypothesis test

2007-08-27 Thread Tom La Bone
Since no reply has been posted yet I will give it a shot. runs.test uses the normal approximation and in your case it returned a z score of -1.8732. This z score has a cumulative probability of pnorm(-1.8732,0,1) [1] 0.03052039 If you are concerned about having too many runs and too few

Re: [R] how to include bar values in a barplot?

2007-08-27 Thread Frank E Harrell Jr
Donatas G. wrote: On Tuesday 07 August 2007 22:09:52 Donatas G. wrote: How do I include bar values in a barplot (or other R graphics, where this could be applicable)? To make sure I am clear I am attaching a barplot created with OpenOffice.org which has barplot values written on top of each

Re: [R] How to provide argument when opening RGui from an external application

2007-08-27 Thread Sébastien
Thanks everyone. I actually thought about ?Rscript.exe but, having used only Rgui, I thought it was a instruction specific to this interface. I will look into it. Sebastien Gabor Grothendieck a écrit : There are also some batch files that can be used with Rscript on XP and info in the README

Re: [R] How to provide argument when opening RGui from an external application

2007-08-26 Thread Sébastien
Thanks for your reply. When you say look into Rscript.exe, do you have a specific document in mind ? I tried to google it but could not find much... I forgot to mention in my first email that I am working under the Windows XP environment. Prof Brian Ripley a écrit : Look into Rscript.exe (on

Re: [R] How to provide argument when opening RGui from an external application

2007-08-26 Thread Duncan Murdoch
On 26/08/2007 7:14 AM, Sébastien wrote: Thanks for your reply. When you say look into Rscript.exe, do you have a specific document in mind ? I tried to google it but could not find much... I forgot to mention in my first email that I am working under the Windows XP environment. You could

Re: [R] How to provide argument when opening RGui from an external application

2007-08-26 Thread Gabor Grothendieck
There are also some batch files that can be used with Rscript on XP and info in the README here: http://batchfiles.googlecode.com On 8/26/07, Sébastien [EMAIL PROTECTED] wrote: Thanks for your reply. When you say look into Rscript.exe, do you have a specific document in mind ? I tried to

Re: [R] How to provide argument when opening RGui from an external application

2007-08-26 Thread Prof Brian Ripley
On Sun, 26 Aug 2007, Duncan Murdoch wrote: On 26/08/2007 7:14 AM, Sébastien wrote: Thanks for your reply. When you say look into Rscript.exe, do you have a specific document in mind ? I tried to google it but could not find much... I forgot to mention in my first email that I am working

[R] How to make an array of data.frames?

2007-08-26 Thread Werner Wernersen
Hi, I am still struggling with the data structures in R. I know how it works in C++ but how can I get such a structure in R? Here is what I want: x[a]$dataframe1 x[a]$dataframe2 x[a]$dataframe3 x[b]$dataframe1 x[b]$dataframe2 x[b]$dataframe3 x[c]$dataframe1 x[c]$dataframe2 x[c]$dataframe3 And

Re: [R] How to make an array of data.frames?

2007-08-26 Thread Gabor Grothendieck
Is this what you want: DF1 - DF2 - DF3 - df1 - df2 - df3 - head(iris) list(a = list(DF1, DF2, DF3), b = list(df1, df2, df3)) or x - list() x$a - list(DF1, DF2, DF3) x$b - list(df1, df2, df3) On 8/26/07, Werner Wernersen [EMAIL PROTECTED] wrote: Hi, I am still struggling with the data

Re: [R] How to make an array of data.frames?

2007-08-26 Thread Gabor Grothendieck
That gives you a list of data frames. An array is a vector with a dim attribute to to make it into an array add the appropriate dim attirbute. If x is the list we created before then: dim(x) - 2 gives us an array of length 2 each of which has a list of 3 elements or dim(x) - 1:2 gives a 1x2

[R] How is R CMD INSTALL --help executed?

2007-08-26 Thread morphwj
Installation Configuration: Windows XP version 5.1 with Service Pack 2, Rtools (bin, MnGW, perl), and HTML HelpWorkshop, and R-2.5.1. Files Located: Scrips build, check and install are in C:\Program Files\R\R-2.5.1\bin. Path Verified: Windows path begins with c:\Rtools\bin;

Re: [R] How is R CMD INSTALL --help executed?

2007-08-26 Thread Duncan Murdoch
On 26/08/2007 3:55 PM, [EMAIL PROTECTED] wrote: Installation Configuration: Windows XP version 5.1 with Service Pack 2, Rtools (bin, MnGW, perl), and HTML HelpWorkshop, and R-2.5.1. Files Located: Scrips build, check and install are in C:\Program Files\R\R-2.5.1\bin. Path Verified:

[R] How can i inhibit this work Please select a CRAN mirror for use in this session ?

2007-08-25 Thread zhijie zhang
Dear Rusers, When i start R, there always the following work to do first, how should i cancel it? *--- Please select a CRAN mirror for use in this session ---* I don't know why it does so, maybe i have done something unintentionally. Thanks. -- With Kind Regards, oooO:

Re: [R] How can i inhibit this work Please select a CRAN mirror for use in this session ?

2007-08-25 Thread Prof Brian Ripley
On Sat, 25 Aug 2007, zhijie zhang wrote: Dear Rusers, When i start R, there always the following work to do first, how should i cancel it? *--- Please select a CRAN mirror for use in this session ---* I don't know why it does so, maybe i have done something unintentionally. You certainly

[R] How to provide argument when opening RGui from an external application

2007-08-25 Thread Sébastien
Dear R-users, I have written a small application (in visual basic) that automatically generate some R scripts. I would like to execute these scripts when my application is being closed. My problem is that I don't know how to pass the 'source(c:/.../myscript.r)' instruction when I

Re: [R] How to provide argument when opening RGui from an external application

2007-08-25 Thread Prof Brian Ripley
Look into Rscript.exe (on Windows), which is a flexible way to run scripts. Neither using a GUI nor using source() are recommended. On Fri, 24 Aug 2007, Sébastien wrote: Dear R-users, I have written a small application (in visual basic) that automatically generate some R scripts. I would

Re: [R] How to shade vertical bands in a graph?

2007-08-25 Thread del pes
nice presentation coming out in no time, R is the best! Delfina Date: Fri, 24 Aug 2007 20:26:53 +1000 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] How to shade vertical bands in a graph? del pes wrote

[R] How can I interpret this test hypothesis test

2007-08-25 Thread Lord Tyranus
Hello wizards, First of all, I'm a physicist and therefore I'm not much used to use statistics. So, please forgive me if this is a FAQ or stupid, but I failed to find the answer by myself. I have used runs.test (Package tseries) for computes the runs test for randomness , but I get this result:

[R] How to shade vertical bands in a graph?

2007-08-24 Thread del pes
Hello, I would like to draw vertical yellow bands in my graph, but could not find how to do that in the documentation. I set up a page to show what I would like to achieve: http://rstudent.blogg.de/eintrag.php?id=1 (the first picture was manually colored with the Gimp). Any help would be

Re: [R] How to merge string to DF

2007-08-24 Thread Stephen Tucker
This seems to work: tmp - aggregate(DF$y, list(DF$x, DF$f), mean) tmp2 - aggregate(DF$conc, list(DF$x, DF$f), paste,collapse=, ) names(tmp2)[3] - var1 final - merge(tmp,tmp2) --- Lauri Nikkinen [EMAIL PROTECTED] wrote: #Hi R-users, #I have an example DF like this: y1 - rnorm(10) + 6.8

Re: [R] How to shade vertical bands in a graph?

2007-08-24 Thread Jim Lemon
del pes wrote: Hello, I would like to draw vertical yellow bands in my graph, but could not find how to do that in the documentation. I set up a page to show what I would like to achieve: http://rstudent.blogg.de/eintrag.php?id=1 (the first picture was manually colored with the Gimp).

Re: [R] How to shade vertical bands in a graph?

2007-08-24 Thread John Kane
?rect Something like this should work but I did not take the time to get the rectangles to fit properly. aa - rnorm(25) yl - -1.5 yh - 2.2 xleft - c(4, 9, 15 ,20) xright - xleft + 3 plot(aa, ylim= c(yl,yh), type=n) rect(xleft, yl, xright,yh, col=yellow) points(aa, col=red) --- del pes [EMAIL

Re: [R] How to shade vertical bands in a graph?

2007-08-24 Thread Gabor Grothendieck
There is an example using classic graphics here: http://www.mayin.org/ajayshah/KB/R/html/g5.html and one using lattice graphics here: library(zoo) ?xyplot.zoo On 8/23/07, del pes [EMAIL PROTECTED] wrote: Hello, I would like to draw vertical yellow bands in my graph, but could not

[R] How to fit an linear model withou intercept

2007-08-23 Thread Michal Kneifl
Please could anyone help me? How can I fit a linear model where an intercept has no sense? Thanks in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] How to fit an linear model withou intercept

2007-08-23 Thread Michael Dewey
At 10:56 23/08/2007, Michal Kneifl wrote: Please could anyone help me? How can I fit a linear model where an intercept has no sense? Well the line has to have an intercept somewhere I suppose. If you use the site search facility and look for known intercept you will get some clues. Thanks in

Re: [R] How to fit an linear model withou intercept

2007-08-23 Thread David Barron
A number of alternatives, such as: lm(y ~ 0 + x) lm(y ~ x -1) See ?formula On 8/23/07, Michal Kneifl [EMAIL PROTECTED] wrote: Please could anyone help me? How can I fit a linear model where an intercept has no sense? Thanks in advance.. Michael

Re: [R] How to fit an linear model withou intercept

2007-08-23 Thread John Kane
?lm Details A formula has an implied intercept term. To remove this use either y ~ x - 1 or y ~ 0 + x. See formula for more details of allowed formulae. Is this what you want? --- Michal Kneifl [EMAIL PROTECTED] wrote: Please could anyone help me? How can I fit a linear model where

Re: [R] How to fit an linear model withou intercept

2007-08-23 Thread Ted Harding
On 23-Aug-07 09:56:33, Michal Kneifl wrote: Please could anyone help me? How can I fit a linear model where an intercept has no sense? Thanks in advance.. Michael Presumably you mean where a non-zero intercept has no sense? Suppose the model you want to fit is like Response ~ B+C+X+Y

Re: [R] How to fit an linear model withou intercept

2007-08-23 Thread John Sorkin
Michael, Assuming you want a model with an intercept of zero, I think we need to ask you why you want an intercept of zero. When a normal regression indicates a non-zero intercet, forcing the regression line to have a zero intercept changes the meaning of the regression coefficients. If for

[R] How to merge string to DF

2007-08-23 Thread Lauri Nikkinen
#Hi R-users, #I have an example DF like this: y1 - rnorm(10) + 6.8 y2 - rnorm(10) + (1:10*1.7 + 1) y3 - rnorm(10) + (1:10*6.7 + 3.7) y - c(y1,y2,y3) x - rep(1:3,10) f - gl(2,15, labels=paste(lev, 1:2, sep=)) g - seq(as.Date(2000/1/1), by=day, length=30) DF - data.frame(x=x,y=y, f=f, g=g) DF$wdays

[R] How do i print a main title on a win.graph with several plots?

2007-08-22 Thread Tom Willems
Good Mornig All, How R you today? ;o) I have lots of questions, but i l start with the simplest one, to wich i am shy to say, i did not find the answer. It is the following: When i make a summary plot like for example plot( summary(glm)), i get one window, one main title, and 4 graph's in

Re: [R] How do i print a main title on a win.graph with several plots?

2007-08-22 Thread Prof Brian Ripley
?title, look at the 'outer' argument. You can see further discussion of the outer margins in 'An Introduction to R'. I don't know why you are using win.graph(): it is a deprecated form of windows() with many of the arguments taking unchangable defaults. On Wed, 22 Aug 2007, Tom Willems wrote:

Re: [R] how do i use the get function to obtain an element from alist...

2007-08-22 Thread Juan Manuel Barreneche
To Mark Leeds and the others, thank you for solving my problem, and so quickly, JM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

[R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Juan Manuel Barreneche
my problem can be explained with the following example: x - 1:12 y - 13:24 a - data.frame(x = x, y = y) ## if i write a$x ## it returns [1] 1 2 3 4 5 6 7 8 9 10 11 12 ## but the function get doesn't recognize a$x. Instead it produces the following error: get(a$x) Error in get(x, envir,

Re: [R] how do i use the get function to obtain an element from alist...

2007-08-21 Thread Leeds, Mark \(IED\)
eval(parse(text=(a$x). You can only use get when it's an object. a$x isn't. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Juan Manuel Barreneche Sent: Tuesday, August 21, 2007 3:35 PM To: r-help@stat.math.ethz.ch Subject: [R] how do i use the get

Re: [R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Duncan Murdoch
On 8/21/2007 3:35 PM, Juan Manuel Barreneche wrote: my problem can be explained with the following example: x - 1:12 y - 13:24 a - data.frame(x = x, y = y) ## if i write a$x ## it returns [1] 1 2 3 4 5 6 7 8 9 10 11 12 ## but the function get doesn't recognize a$x. Instead

Re: [R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Henrique Dallazuanna
Hi, you can try this: eval(parse(text=a$x)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 21/08/07, Juan Manuel Barreneche [EMAIL PROTECTED] wrote: my problem can be explained with the following example: x - 1:12 y - 13:24 a - data.frame(x = x, y = y) ##

Re: [R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Tony Plate
One simple way that I haven't seen mentioned yet is to do: get(a)$x (which of course allows further variants such as get(a)$x[3:6] ...) -- Tony Plate Juan Manuel Barreneche wrote: my problem can be explained with the following example: x - 1:12 y - 13:24 a - data.frame(x = x, y = y)

[R] How to parse a string into the symbol for a data frame object

2007-08-19 Thread Darren Weber
I have several data frames, eg: df1 - data.frame(x=seq(0,10), y=seq(10,20)) df2 - data.frame(a=seq(0,10), b=seq(10,20)) It is common to create loops in R like this: for(df in list(df1, df2)){ #etc. } This works fine when you know the name of the objects to put into the list. I assume that

Re: [R] How to parse a string into the symbol for a data frame object

2007-08-19 Thread jim holtman
One way to do it is to pass in the character name of the dataframe you want to reference and then use 'get' to access the value: e.g., df1 - data.frame(x=seq(0,10), y=seq(10,20)) df2 - data.frame(a=seq(0,10), b=seq(10,20)) # use the character names for referencing for (df in c('df1', 'df2')){

Re: [R] How to parse a string into the symbol for a data frame object

2007-08-19 Thread Gabor Grothendieck
You might want to store the data frames in a list to eliminate this problem and make it more convenient to iterate over them: L - list(df1 = df1, df2 = df2) rm(df1, df2) # reduce each data frame to its first few rows for(nm in names(L)) L[[nm]] - head(L[[nm]) or if you don't need to modify

[R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread adschai
Hi, I encounter a situation where I have a list whose element is a column matrix. Says, $'1' [,1] 1 2 3 $'2' [,1] 4 5 6 Is there fast way to collapse the list into a matrix like a cbind operation in this case? Meaning, the result should be a matrix that looks like: [,1] [,2] [1,]

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread François Pinard
[EMAIL PROTECTED] I encounter a situation where I have a list whose element is a column matrix. Says, $'1' [,1] 1 2 3 $'2' [,1] 4 5 6 Is there fast way to collapse the list into a matrix like a cbind operation in this case? Meaning, the result should be a matrix that looks like:

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread adschai
Ah, it works. I was using lapply and it doesn't seem to work. Thank you!- Original Message -From: François Pinard Date: Sunday, August 19, 2007 8:36 pmSubject: Re: [R] how to collapse a list of 1 column matrix to a matrix?To: [EMAIL PROTECTED]: r-help@stat.math.ethz.ch [EMAIL PROTECTED

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread Gabor Grothendieck
Try this: L - list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4)) sapply(L, c) Note that the list component names are kept as column names in the result On 8/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I encounter a situation where I have a list whose element is a column matrix.

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread adschai
- Original Message -From: Gabor Grothendieck Date: Sunday, August 19, 2007 8:48 pmSubject: Re: [R] how to collapse a list of 1 column matrix to a matrix?To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Try this: L - list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4)) sapply(L, c) Note

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread Jared O'Connell
-From: Gabor Grothendieck Date: Sunday, August 19, 2007 8:48 pmSubject: Re: [R] how to collapse a list of 1 column matrix to a matrix?To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Try this: L - list(`1` = matrix(1:4, 4), `2` = matrix(5:8, 4)) sapply(L, c) Note that the list component

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread François Pinard
[EMAIL PROTECTED] One more question. After I collapse everything into one matrix, I would like to find the index of column that holds minimum value for each row. I remember that there is a function like maxCols but I can't seem to find the same thing for minimum value. Any suggestion

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread adschai
Thank you. I found the same answer. - Original Message -From: Jared O'Connell Date: Sunday, August 19, 2007 9:56 pmSubject: Re: [R] how to collapse a list of 1 column matrix to a matrix?To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch x = matrix(rnorm(9),3) x[,1

[R] How to create several variables from composite character variable

2007-08-17 Thread Dale Steele
I'm trying to create two variables (dka and newsonset) from the following composite character variable diagnosis: diagnosis - c(hypoglycemia,diabetes ,newonsetdka, newonset, diabetes, dkaGI, diabetesGI, newonset, dka) I can extract the indices for dka and newonset using the following

Re: [R] How to create several variables from composite character variable

2007-08-17 Thread Daniel Lakeland
On Fri, Aug 17, 2007 at 05:32:54PM -0400, Dale Steele wrote: I'm trying to create two variables (dka and newsonset) from the following composite character variable diagnosis: diagnosis - c(hypoglycemia,diabetes ,newonsetdka, newonset, diabetes, dkaGI, diabetesGI, newonset, dka) I can

Re: [R] How to create several variables from composite character variable

2007-08-17 Thread Marc Schwartz
On Fri, 2007-08-17 at 14:40 -0700, Daniel Lakeland wrote: On Fri, Aug 17, 2007 at 05:32:54PM -0400, Dale Steele wrote: I'm trying to create two variables (dka and newsonset) from the following composite character variable diagnosis: diagnosis - c(hypoglycemia,diabetes ,newonsetdka,

Re: [R] How to write to a table column by column?

2007-08-15 Thread Moshe Olshansky
Hi Yuchen, First of all please notice that you may not have more than 2^8 = 256 columns in Excel, so if you have more than 256 time-series you can not put them all in one Excel sheet. I also believe that you can not have more than 2^16 = 65536 rows. If you do not have more than 256 time-series, I

Re: [R] How to store the parameter estimated by nls( ) to a variable?

2007-08-13 Thread Joerg van den Hoff
On Sun, Aug 12, 2007 at 10:50:59AM -0700, Yuchen Luo wrote: Dear Professor Murdoch. Thank you so much Best Wishes Yuchen Luo On 8/12/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Yuchen Luo wrote: Dear Colleagues. I believe this should be a problem encountered by many:

Re: [R] How to write to a table column by column?

2007-08-13 Thread jim holtman
Assuming that the daily.incomes are the same lengths, then your loop could be: Lst - list() for (i in 1:count) Lst[[i]] - list(..) Lst.col - do.call('cbind', Lst) On 8/12/07, Yuchen Luo [EMAIL PROTECTED] wrote: Dear friends. Every loop of my program will result in a list that is very long,

[R] How to store the parameter estimated by nls( ) to a variable?

2007-08-12 Thread Yuchen Luo
Dear Colleagues. I believe this should be a problem encountered by many: nls( ) is a very useful and efficient function to use if we are just to display the estimated value on screen. What if we need R to store the estimated parameter in a variable? For example: x=rnorm(10, mean=1000, sd=10)

  1   2   3   4   5   6   7   8   9   10   >