Re: [R] Simulation

2009-05-14 Thread Dimitris Rizopoulos
Wacek Kusnierczyk wrote: Barry Rowlingson wrote: On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Barry Rowlingson wrote: Soln - for loop: z=list() for(i in 1:1000){z[[i]]=rnorm(100,0,1)} now inspect the individual bits: hist(z[[1]])

Re: [R] Graphical output format

2009-05-14 Thread Daniel Malter
Hi, postscript should do, *.eps specifically. x=rnorm(100,0,1) e=rnorm(100,0,1) y=x+e postscript(myeps.eps) plot(y~x) dev.off() Cheers, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org

[R] Finding root using Newton's method

2009-05-14 Thread Harry P
I want generate R code to determine the real root of the polynomial x^3-2*x^2+3*x-5. Using an initial guess of 1 with Newton's method. Help please... -- View this message in context: http://www.nabble.com/Finding-root-using-Newton%27s-method-tp23534519p23534519.html Sent from the R help mailing

[R] Duplicates and duplicated

2009-05-14 Thread christiaan pauw
Hi everybody. I want to identify not only duplicate number but also the original number that has been duplicated. Example: x=c(1,2,3,4,4,5,6,7,8,9) y=duplicated(x) rbind(x,y) gives: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x123445678 9 y0

Re: [R] R Tools To Evaluate Confidence Interval

2009-05-14 Thread J Dougherty
On Wednesday 13 May 2009 10:54:01 pm Peverall Dubois wrote: Hi, Suppose I have a calculation that contain an estimation of certain value and its confidence interval (this is computed via Chi Square approximation). Is there any approach in R in which we can evaluate the confidence interval?

Re: [R] Duplicates and duplicated

2009-05-14 Thread Linlin Yan
On Thu, May 14, 2009 at 2:16 PM, christiaan pauw cjp...@gmail.com wrote: Hi everybody. I want to identify not only duplicate number but also the original number that has been duplicated. Example: x=c(1,2,3,4,4,5,6,7,8,9) y=duplicated(x) rbind(x,y) gives:    [,1] [,2] [,3] [,4] [,5] [,6]

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: On Wed, May 13, 2009 at 9:56 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Barry Rowlingson wrote: n = 1000 benchmark(columns=c('test', 'elapsed'), order=NULL, 'for'={ l = list(); for (i in 1:n) l[[i]] = rnorm(i, 0, 1)

Re: [R] Finding root using Newton's method

2009-05-14 Thread Daniel Malter
Homework? - see your instructor! Otherwise, provide minimal self-contained code and show us where you are stuck. - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: [...] Yes, you can probably vectorize this with lapply or something, but I prefer clarity over concision when dealing with beginners... but where's the preferred clarity in the for loop solution? Seriously? You think: lapply(1:n, rnorm, 0, 1) is

Re: [R] R Tools To Evaluate Confidence Interval

2009-05-14 Thread Peverall Dubois
Yes, they don't seem to show ways to evaluate confidence interval though. Only functions for computing confidence interval. -G.V On Thu, May 14, 2009 at 3:19 PM, J Dougherty j...@surewest.net wrote: On Wednesday 13 May 2009 10:54:01 pm Peverall Dubois wrote: Hi, Suppose I have a calculation

Re: [R] Searching within a ch. string

2009-05-14 Thread RON70
Thanks for these suggestions. However I have one more question. Is there any way to extract only numbers? For example I want to extract only 88 in my example. Regards, MUHC-Research wrote: Hi Ron, Look up the grep() function. Cheers, -- *Luc Villandré* /Biostatistician McGill

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Dimitris Rizopoulos wrote: Wacek Kusnierczyk wrote: Barry Rowlingson wrote: On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Barry Rowlingson wrote: Soln - for loop: z=list() for(i in 1:1000){z[[i]]=rnorm(100,0,1)} now inspect the

Re: [R] Searching within a ch. string

2009-05-14 Thread Wacek Kusnierczyk
RON70 wrote: Thanks for these suggestions. However I have one more question. Is there any way to extract only numbers? For example I want to extract only 88 in my example. if you have just one integer number represented in a single string, here's one way go: strings = c('foo 1', '2

Re: [R] newtons method

2009-05-14 Thread Hans W. Borchers
Dear Ravi: Thanks for pointing out the homotopy methods. Coming from Mathematics I was always considering SINGULAR for such a task which is also providing results when the solution set is not isolated points, but an algebraic variety. For single points, homotopy methods appear to be an

Re: [R] Finding root using Newton's method

2009-05-14 Thread Richard . Cotton
I want generate R code to determine the real root of the polynomial x^3-2*x^2+3*x-5. Using an initial guess of 1 with Newton's method. Homework? - see your instructor! Otherwise, provide minimal self-contained code and show us where you are stuck. It gets a little suspicious when there are

Re: [R] Graphical output format

2009-05-14 Thread Dieter Menne
Stats Wolf stats.wolf at gmail.com writes: Saving a plot with pdf gives a very nice result: pdf(myplot.pdf) par(font=1,family='serif') plot(pressure) dev.off() Doing the very same with other formats (png, jpeg, tiff) gives far worse results. Is there anything to do to make a plot in

Re: [R] Graphical output format

2009-05-14 Thread Stats Wolf
Thank you, Paul. Postscript, however, does not have to be what I need for two reasons. First, it does not accept some special characters from foreign languages (exactly like PDF). Second, not too many journals accept it. So from your -- and Daniel's -- reply I understand other formats will not

Re: [R] matching period with perl regular expression

2009-05-14 Thread Dieter Menne
Gabor Grothendieck ggrothendieck at gmail.com writes: R interprets backslash to give special meaning to the next character, i.e. it strips off the backslash and send the following character to gsub possibly reinterpreting it specially (for example \n is newline). Thus a backslash will

Re: [R] Duplicates and duplicated

2009-05-14 Thread Andrej Blejec
Try this x%in%x[which(y)] From your example x=c(1,2,3,4,4,5,6,7,8,9) y=duplicated(x) rbind(x,y) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x123445678 9 y000010000 0 which(y) [1] 5 x[which(y)] [1] 4

Re: [R] scatterplot3d

2009-05-14 Thread Uwe Ligges
Nair, Murlidharan T wrote: Does anyone have any suggestion on this? I tried par(new=T) It does not seem to work with scatterplot3d. Any suggestion is appreciated. Cheers../Murli Please be patient for a day or two before expecting a reply. If you expect some Europeans to answer: Not all of

[R] Data extraction problem after importation using RODBC

2009-05-14 Thread Axel Leroix
Dear all,   I write this message because I have a problem in data importation. I hope that you help me. My data base is in an Excel spreasheet. I import this data base using the following code: library(RODBC) db - C:/Users/Axel/Desktop/estimation/data.xls channel - odbcConnectExcel(xls.file =

[R] Least-square support vector machines regression!

2009-05-14 Thread Thomas Terhoeven-Urselmans
Dear R-community, I was using SVM regression (svm {e1071}) for predictions of single soil properties of a huge data set (3000 samples). There are for the eps-regression using the radial basis kernel three optimization parameters needed. To make things easier (using only two optimization

[R] corrupted smoothing kernel ?

2009-05-14 Thread mauede
I am trying to use the kernel function. To understand how it works I tried out some of the examples. None of them works as shown in the following: kernel(daniell, 50) # Error in kernel(daniell, 50) : unused argument(s) (50) kernel(daniell, 10) # Error in kernel(daniell, 10) : unused

Re: [R] Simulation

2009-05-14 Thread Peter Flom
Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote Seriously? You think: lapply(1:n, rnorm, 0, 1) is 'clearer' than: x=list() for(i in 1:n){ x[[i]]=rnorm(i,0,1) } for beginners? Firstly, using 'lapply' introduces a function (lapply) that doesn't have an intuitive

Re: [R] Duplicates and duplicated

2009-05-14 Thread Linlin Yan
The operator %in% is very good! And that can be simpler like this: x %in% x[duplicated(x)] [1] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE On Thu, May 14, 2009 at 4:43 PM, Andrej Blejec andrej.ble...@nib.si wrote: Try this x%in%x[which(y)] From your example

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Peter Flom wrote: Seriously? You think: lapply(1:n, rnorm, 0, 1) is 'clearer' than: x=list() for(i in 1:n){ x[[i]]=rnorm(i,0,1) } for beginners? Firstly, using 'lapply' introduces a function (lapply) that doesn't have an intuitive name. Also, it takes a function as an

Re: [R] Checking a (new) package - examples require other package functions

2009-05-14 Thread Duncan Murdoch
On 13/05/2009 2:38 PM, Rebecca Sela wrote: I am creating an R package. I ran R CMD check on the package, and everything passed until it tried to run the examples. Then, the result was: * checking examples ... ERROR Running examples in REEMtree-Ex.R failed. The error most likely occurred in:

Re: [R] Simulation)

2009-05-14 Thread Peter Flom
I wrote As a beginner, I agree the for loop is much clearer to me. Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no replied well, that's quite likely. especially given that typical courses in programming, afaik, include for looping but not necessarily functional stuff -- are

Re: [R] Simulation

2009-05-14 Thread Barry Rowlingson
As a beginner, I agree the for loop is much clearer to me. [Warning: Contains mostly philosophy] To me, the world and how I interact with it is procedural. When I want to break six eggs I do 'get six eggs, repeat break egg until all eggs broken'. I don't apply an instance of the break

Re: [R] Simulation)

2009-05-14 Thread Wacek Kusnierczyk
Peter Flom wrote: As a beginner, I agree the for loop is much clearer to me. well, that's quite likely. especially given that typical courses in programming, afaik, include for looping but not necessarily functional stuff -- are you an r beginner, or a programming beginner?

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: As a beginner, I agree the for loop is much clearer to me. [Warning: Contains mostly philosophy] maybe quasi ;) To me, the world and how I interact with it is procedural. When I want to break six eggs I do 'get six eggs, repeat break egg until all

[R] replacing default axis labels on a plot

2009-05-14 Thread Graves, Gregory
I have 3 columns: flow, month, and monthname, where month is 1-12, and monthname is name of month. I can't get the plot to replace the 1-12 with monthname using ticks.lab. What am I doing wrong? plot(flow~factor(month),xlab=Month,ylab=Total Flow per Month, ylim=c(0,55000), ticks.lab=monthname)

[R] specify the number of decimal numbers

2009-05-14 Thread lehe
Hi, I was wondering how to specify the number of decimal numbers in my computation using R? I have too many decimal numbers for my result, when I convert them to string with as.character, the string will be too long. Thanks and regards! -- View this message in context:

Re: [R] Simulation

2009-05-14 Thread Ted Harding
On 14-May-09 11:28:17, Wacek Kusnierczyk wrote: Barry Rowlingson wrote: As a beginner, I agree the for loop is much clearer to me. [Warning: Contains mostly philosophy] maybe quasi ;) To me, the world and how I interact with it is procedural. When I want to break six eggs I do

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: Computer scientists will write their beautiful manuscripts, but how many people who come to R because they want to do a t-test or fit a GLM will read them? That's the R-help audience now. don't forget that r seems to take, maybe undeserved, the pride of being a

Re: [R] specify the number of decimal numbers

2009-05-14 Thread jim holtman
Depending on what you want to do, use 'sprintf': x - 1.23456789 x [1] 1.234568 as.character(x) [1] 1.23456789 sprintf(%.1f %.3f %.5f, x,x,x) [1] 1.2 1.235 1.23457 On Thu, May 14, 2009 at 7:40 AM, lehe timlee...@yahoo.com wrote: Hi, I was wondering how to specify the number of

Re: [R] Graphical output format

2009-05-14 Thread Frank E Harrell Jr
Stats Wolf wrote: Dear colleagues, Saving a plot with pdf gives a very nice result: pdf(myplot.pdf) par(font=1,family='serif') plot(pressure) dev.off() Doing the very same with other formats (png, jpeg, tiff) gives far worse results. Is there anything to do to make a plot in some other format

Re: [R] Histogram + % of cases for a given criteria

2009-05-14 Thread Jim Lemon
S. Nunes wrote: Hi all, I am doing some explorations using a dataset with the following structure (id, value, flag). For instance: a, 2.2, 1 b, 3.0, 1 c, 2.9, 0 d, 3.1, 1 ... I have plotted a standard histogram using a simple command like: hist(data$value) My question: I would like to

Re: [R] specify the number of decimal numbers

2009-05-14 Thread baptiste auguie
Alternatively, signif(c(pi,exp(1)), 3) ?signif # and others in that page HTH, baptiste On 14 May 2009, at 13:47, jim holtman wrote: Depending on what you want to do, use 'sprintf': x - 1.23456789 x [1] 1.234568 as.character(x) [1] 1.23456789 sprintf(%.1f %.3f %.5f, x,x,x) [1] 1.2

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Ted Harding
On 14-May-09 11:40:21, lehe wrote: Hi, I was wondering how to specify the number of decimal numbers in my computation using R? I have too many decimal numbers for my result, when I convert them to string with as.character, the string will be too long. Thanks and regards! Since you say you

Re: [R] specify the number of decimal numbers

2009-05-14 Thread lehe
Thanks! In my case, I need to deal with a lot of such results, e.g. elements in a matrix. If using sprintf, does it mean I have to apply to each result individually? Is it possible to do it in a single command? jholtman wrote: Depending on what you want to do, use 'sprintf': x -

Re: [R] replacing default axis labels on a plot

2009-05-14 Thread Duncan Murdoch
On 14/05/2009 7:31 AM, Graves, Gregory wrote: I have 3 columns: flow, month, and monthname, where month is 1-12, and monthname is name of month. I can't get the plot to replace the 1-12 with monthname using ticks.lab. What am I doing wrong? plot(flow~factor(month),xlab=Month,ylab=Total Flow

Re: [R] ode first step

2009-05-14 Thread Benoit Boulinguiez
As I do not thoroughly understand the way 'lsoda' works, I face some difficulties to 'get' myself into the function(), though I changed the code as follows: -- require(deSolve) qm-0.36 y0-c(0) parms-c(K1,K2) times-seq(0,1,1) kinetic.model-function(t,y,parms){

Re: [R] specify the number of decimal numbers

2009-05-14 Thread jim holtman
It all depends on what you want to do with the result. Here are some variations: x - matrix(runif(16), 4) x [,1] [,2] [,3] [,4] [1,] 0.2655087 0.2016819 0.62911404 0.6870228 [2,] 0.3721239 0.8983897 0.06178627 0.3841037 [3,] 0.5728534 0.9446753 0.20597457 0.7698414

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Wacek Kusnierczyk
jim holtman wrote: Depending on what you want to do, use 'sprintf': x - 1.23456789 x [1] 1.234568 as.character(x) [1] 1.23456789 sprintf(%.1f %.3f %.5f, x,x,x) [1] 1.2 1.235 1.23457 ... but remember that sprintf introduces excel bugs into r

Re: [R] Simulation

2009-05-14 Thread Debbie Zhang
Thanks for everyone. I think the approach below is most suitable for me, as a beginner. x=list() for(i in 1:n){ x[[i]]=rnorm(i,0,1) } Now, I am trying to obtain the sample variance (S^2) of the 1000 samples that I have generated before. I am wondering what command I should use in

Re: [R] Least-square support vector machines regression!

2009-05-14 Thread Max Kuhn
To make things easier (using only two optimization parameters and not loosing performance) I wanted to use LS SVM regression (lssvm{kernlab}). But it looks to me that it is not yet implemented. At least I got error messages, which I could not find a solution for (Error in if (n !_dim(y)[1]

Re: [R] Searching within a ch. string

2009-05-14 Thread Gabor Grothendieck
If the input is gdfsa-sdhchc99-88 then assuming you only want 88 but not 99 then if s is the vector of words that we already computed: s[regexpr(^[0-9]+, s) 0] or that could be combined with the strapply solution into one line: strapply(gdfsa-sdhchc99-88, \\w+, ~ if (regexpr(^[0-9]*$, x) 0)

Re: [R] specify the number of decimal numbers

2009-05-14 Thread lehe
Thanks to all of you! Yes, I am generating a latex table in my report. jholtman wrote: It all depends on what you want to do with the result. Here are some variations: x - matrix(runif(16), 4) x [,1] [,2] [,3] [,4] [1,] 0.2655087 0.2016819 0.62911404

[R] latex.table used with mixed string and numbers

2009-05-14 Thread lehe
Hi, I am using latex.table to write my results into a latex table. If my results is like a matrix except that some column has strings and others have numbers. Is it possible to feed my results into latex.table? Thanks and regards! -- View this message in context:

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Ted Harding
On 14-May-09 12:03:43, lehe wrote: Thanks! In my case, I need to deal with a lot of such results, e.g. elements in a matrix. If using sprintf, does it mean I have to apply to each result individually? Is it possible to do it in a single command? Yes, in various ways depending on how you

Re: [R] Simulation

2009-05-14 Thread Stefan Grosse
Debbie Zhang schrieb: Now, I am trying to obtain the sample variance (S^2) of the 1000 samples that I have generated before. I am wondering what command I should use in order to get the sample variance for all the 1000 samples. What I am capable of doing now is just typing in

Re: [R] scatterplot3d

2009-05-14 Thread Nair, Murlidharan T
-Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Thursday, May 14, 2009 4:44 AM To: Nair, Murlidharan T Cc: r-help@r-project.org Subject: Re: [R] scatterplot3d Nair, Murlidharan T wrote: Does anyone have any suggestion on this? I tried par(new=T)

Re: [R] Checking a (new) package - examples require other package functions

2009-05-14 Thread spencerg
Another way of making functions visible to examples is to list the package name as Depends in the package DESCRIPTION file. Alternatively, if you precede use in \examples with library(packageName), you should also list it as Suggests in DESCRIPTION. Hope this helps. Spencer

Re: [R] Simulation

2009-05-14 Thread Linlin Yan
Since you got the most suitable way to get x, why can't you get the variances in the same way? Just like: v = vector() for (i in 1:length(x)) v[i] = var(x[[i]]) BTW, it is much better to use lapply, like this: lapply(x, var) On Thu, May 14, 2009 at 8:26 PM, Debbie Zhang

Re: [R] replacing default axis labels on a plot

2009-05-14 Thread Graves, Gregory
Thanks. But ... Still don't get it. Referring explicitly to the monthname column which had many entries across many years did not work. So taking your clue I created a new variable list of names of month month.name-list(c(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)) then

Re: [R] latex.table used with mixed string and numbers

2009-05-14 Thread Dieter Menne
lehe wrote: I am using latex.table to write my results into a latex table. If my results is like a matrix except that some column has strings and others have numbers. Is it possible to feed my results into latex.table? Such a matrix-like structure is called a dataframe. See latex in

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Ted Harding
On 14-May-09 12:27:40, Wacek Kusnierczyk wrote: jim holtman wrote: Depending on what you want to do, use 'sprintf': x - 1.23456789 x [1] 1.234568 as.character(x) [1] 1.23456789 sprintf(%.1f %.3f %.5f, x,x,x) [1] 1.2 1.235 1.23457 ... but remember that sprintf introduces

Re: [R] replacing default axis labels on a plot

2009-05-14 Thread Uwe Ligges
Graves, Gregory wrote: Thanks. But ... Still don't get it. Referring explicitly to the monthname column which had many entries across many years did not work. So taking your clue I created a new variable list of names of month month.name-list(c(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep,

Re: [R] Data extraction problem after importation using RODBC

2009-05-14 Thread Dieter Menne
Axel Leroix wrote: Then I perform an lm regression using the following code: reg1 -lm(data$prod~data$pri+data$cli) summary(reg1) Use reg1 -lm(prod~pri+cli, data=data) instead. It is not necessary to call the data frame you read your stuff into data, any more useful name, such as

[R] extract decision tree from rpart

2009-05-14 Thread lehe
Hi, I am using rpart for my decision stump. I am trying to extract the learned stump from the output of rpart. For example: cntrl - rpart.control(maxdepth = 1, minsplit = learn-1, maxsurrogate = 0, usesurrogate=0, maxcompete = 1, cp = 0,

Re: [R] 3dscatter for linux

2009-05-14 Thread Uwe Ligges
threshold wrote: Hi, do you have any suggestions how to make 3D scatterplot, BUT under linux. Worth mentioning is the fact that 'scatterplot3d' does not load under Ubuntu 8.10. Why not? It is in pure R code, hence it is just as OS dependent as R itself. Uwe Ligges Do you know any

Re: [R] Simulation

2009-05-14 Thread Wacek Kusnierczyk
Stefan Grosse wrote: Debbie Zhang schrieb: Now, I am trying to obtain the sample variance (S^2) of the 1000 samples that I have generated before. I am wondering what command I should use in order to get the sample variance for all the 1000 samples. What I am capable of doing now

[R] dissimilarities table factorial analysis

2009-05-14 Thread Lassana TOURE
I have genetic data, and I would like to do an dissimilariry table of the factorial analysis. What package should I use and the command line? Lassana TOURE [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] corrupted smoothing kernel ?

2009-05-14 Thread Uwe Ligges
mau...@alice.it wrote: I am trying to use the kernel function. To understand how it works I tried out some of the examples. None of them works as shown in the following: kernel(daniell, 50) # Error in kernel(daniell, 50) : unused argument(s) (50) which works for me. Have you

Re: [R] question about setClass

2009-05-14 Thread Uwe Ligges
Erin Hodgess wrote: Hi R People: I have a question about setClass please. I'm working thru R Programming for Bioinformatics. Actually, I was wondering if there is such a thing as an updateClass, in order to change a contains option, please? that is, if I had setClass(dog,

Re: [R] Duplicates and duplicated

2009-05-14 Thread Gabor Grothendieck
Noting that: ave(x, x, FUN = length) 1 [1] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE try this: rbind(x, dup = ave(x, x, FUN = length) 1) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x 123445678 9 dup0001

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Wacek Kusnierczyk
(Ted Harding) wrote: On 14-May-09 12:27:40, Wacek Kusnierczyk wrote: ... but remember that sprintf introduces excel bugs into r (i.e., rounding is not done according to the IEC 60559 standard, see ?round): ns = c(0.05, 0.15) round(ns, 1) # 0.0 0.2

Re: [R] specify the number of decimal numbers

2009-05-14 Thread James W. MacDonald
Wacek Kusnierczyk wrote: (Ted Harding) wrote: On 14-May-09 12:27:40, Wacek Kusnierczyk wrote: ... but remember that sprintf introduces excel bugs into r (i.e., rounding is not done according to the IEC 60559 standard, see ?round): ns = c(0.05, 0.15) round(ns, 1) # 0.0 0.2

Re: [R] plotting multiple data sources

2009-05-14 Thread Greg Snow
It is not recommended to plot variables on different scales on the same graph. You can use something like par(mfrow=...) (see ?par) to stack graphs on top of each other (or next to each other, or both) for easy comparison, but each with their own scales/axes. If you have considered all that

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Wacek Kusnierczyk
James W. MacDonald wrote: Wacek Kusnierczyk wrote: (Ted Harding) wrote: On 14-May-09 12:27:40, Wacek Kusnierczyk wrote: ... but remember that sprintf introduces excel bugs into r (i.e., rounding is not done according to the IEC 60559 standard, see ?round): ns = c(0.05, 0.15)

[R] EM algorithm for mixture of two Weibull distributions (Urgent)

2009-05-14 Thread Ndoye Abdoul aziz
Good morning. I want to estimate a mixture of two Weibull distribution by using the EM algorithm . Does it exist an available package to do that ? Or if not, Is it some avaible EM Algorithm ? Thanks Cordially Abdoul Aziz Junior NDOYE GREQAM Marseille. [[alternative

[R] I want to avioid unnecessary value

2009-05-14 Thread Grześ
I have a database like this: kol1;kol2;kol3 ... 2;5;9 9;6;6 4;6;5... I looking for a kod in R which let mi aviod in column unnecessary value, for example number 9. So, if I have: Kol1 2 9 4 4... after loop in R I would like to get my column like this: Kol1 2 4 4... If you have any idea

[R] I can't install RWeka

2009-05-14 Thread Grześ
If I want to install RWeka I get an error: library(RWeka) Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread Could you have any idea to help me? -- View this message in context:

[R] can I plot a matrix of colors?

2009-05-14 Thread dxc13
Hi all, I have a 36x14 matrix of hexadecimal coded colors (see attached file) that was created with the following code: cellcol[is.na(cellcol)] - #00 #Aliceblue cellcol[cellcol 5] - #F0F8FF #Skyblue1 cellcol[cellcol = 5 cellcol 20] - #87CEFF #Blue cellcol[cellcol = 20 cellcol 35] -

Re: [R] specify the number of decimal numbers

2009-05-14 Thread James W. MacDonald
Wacek Kusnierczyk wrote: do they make pompous claims about their software and disregarding claims about others' as well? My mistake. I thought your concern was for the quality of the software (quality of course being defined by a certain committee of one). But it appears this is of a more

[R] Bayesian 2*2 table independence test

2009-05-14 Thread Christian Hennig
Dear list, I'd like to test the null hypothesis of independence in a 2*2 contingency table in a Bayesian way. As far as I can see, this can be done by the function ctable in library LearnBayes. (More precisely, a Bayes factor can be computed.) Two questions: 1) Is there any other

[R] using multiple matrices

2009-05-14 Thread Penner, Johannes
Dear R-list, another question trying to build consensus cluster ;-) Using the package clue I have found a method of building consensus clusters the following way from one distance matrix: clust1 - c(ward, single, complete, average, mcquitty, median, centroid) clust_res - lapply(clust1,

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Wacek Kusnierczyk
James W. MacDonald wrote: Wacek Kusnierczyk wrote: do they make pompous claims about their software and disregarding claims about others' as well? My mistake. I thought your concern was for the quality of the software (quality of course being defined by a certain committee of one). But it

Re: [R] I want to avioid unnecessary value

2009-05-14 Thread Dimitri Liakhovitski
I am not sure what you are trying to achive. How about: df-data.frame(kol1=c(2,9,4,3),kol2=c(5,6,6,2),kol3=c(9,6,5,1)) (df) new.df-df[(!(df[[1]] %in% 9)!(df[[2]] %in% 9)!(df[[3]] %in% 9)),] (new.df) But why would you want to delete all the valid values in all the other columns if you have your

Re: [R] Duplicates and duplicated

2009-05-14 Thread Bert Gunter
... or, similar in character to Gabor's solution: tbl - table(x) (tbl[as.character(sort(x))]1)+0 Bert Gunter Nonclinical Biostatistics 467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Thursday,

[R] Rpart - user defined split functions

2009-05-14 Thread Paolo Radaelli
Dear all, I'm writing my own method to be used in Rpart by defining the list of functions named init, split and eval. I'm following the example given in the file 'tests/usersplits.R' in the sources. By now I'm able to define the split function (and it works correctly in the tree construction)

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Ted Harding
On 14-May-09 15:15:16, James W. MacDonald wrote: Wacek Kusnierczyk wrote: (Ted Harding) wrote: On 14-May-09 12:27:40, Wacek Kusnierczyk wrote: ... but remember that sprintf introduces excel bugs into r (i.e., rounding is not done according to the IEC 60559 standard, see ?round):

Re: [R] specify the number of decimal numbers

2009-05-14 Thread Wacek Kusnierczyk
(Ted Harding) wrote: This happens also when you use C's fprintf and sprintf (at any rate in my gcc): r's printing routines (e.g., print, sprintf, cat, anything else?) seem to rely on the underlying c sprintf, with no prior r-implemented rounding. hence they import into r whatever

Re: [R] creating a postscript file with two xyplots

2009-05-14 Thread Deepayan Sarkar
On 5/13/09, Liati liat...@hotmail.com wrote: Hi, Thank you for your reply. This is exactly what I have done. However, I would like to get the two plots next to each other (to use as one figure). Look at ?print.trellis and its examples. -Deepayan

[R] automated polynomial regression

2009-05-14 Thread Dieter Wirz
Dear all - We perform some measurements with a machine that needs to be recalibrated. The best calibration we get with polynomial regression. The data might look like follows: true_y - c(1:50)*.8 # the real values m_y - c((1:21)*1.1, 21.1, 22.2, 23.3 ,c(25:50)*.9)/0.3-5.2 # the measured data

Re: [R] Strip labels: use xyplot() to plot columns in parallel with outer=TRUE

2009-05-14 Thread Deepayan Sarkar
On 5/9/09, John Maindonald john.maindon...@anu.edu.au wrote: The following tinkers with the strip labels, where the different panels are for different levelf of a conditioning factor. tau - (0:5)/2.5; m - length(tau); n - 200; SD - 2 x0 - rnorm(n, mean=12.5, sd=SD) matdf - data.frame(

Re: [R] automated polynomial regression

2009-05-14 Thread Luc Villandre
Dieter Wirz wrote: Dear all - We perform some measurements with a machine that needs to be recalibrated. The best calibration we get with polynomial regression. The data might look like follows: true_y - c(1:50)*.8 # the real values m_y - c((1:21)*1.1, 21.1, 22.2, 23.3 ,c(25:50)*.9)/0.3-5.2

Re: [R] automated polynomial regression

2009-05-14 Thread Bert Gunter
-- but it is preferable to use the appropriate access functions: coef(mylm) ?coef Bert Gunter Nonclinical Biostatistics 467-7374 ## Now, what I believe you're looking for ; mylm$coefficients ; Cheers, -- *Luc Villandré* /Biostatistician McGill University Health Center - Montreal

Re: [R] Duplicates and duplicated

2009-05-14 Thread jim holtman
Don't think I have seen this one come across: x - c(1,2,3,2,4,4,6,1) duplicated(x) | duplicated(x, fromLast=TRUE) [1] TRUE TRUE FALSE TRUE TRUE TRUE FALSE TRUE On Thu, May 14, 2009 at 12:09 PM, Bert Gunter gunter.ber...@gene.comwrote: ... or, similar in character to Gabor's solution:

[R] text() to label points in ggplot

2009-05-14 Thread stephenb
is there a way to label points in a graph using text(locator(1),text) after ggplot() or qplot() ? qplot(date, psavert, data = economics, geom = line,main=jhdjd)-p p+opts(text(locator(1),),new=T) does not work. -- View this message in context:

[R] Importing data into R and combining 2 files

2009-05-14 Thread Sunita22
Hello I have to import 2 txt files into R. 1 file contains the data and the other contains the header, column headings, datatypes and labels for the data. I have 2 problems: 1) my data file has mixed type of data e.g. 1 2 3 4 5 3-5 02/04/06 3 4 5 and so on, the data file is tab separated. when

Re: [R] Importing data into R and combining 2 files

2009-05-14 Thread jim holtman
What have you tried? Check the Intro manual for hints. ?read.table probably using sep='\t' On Thu, May 14, 2009 at 1:30 PM, Sunita22 sunita...@gmail.com wrote: Hello I have to import 2 txt files into R. 1 file contains the data and the other contains the header, column headings,

Re: [R] Importing data into R and combining 2 files

2009-05-14 Thread Sunita Patil
Hello Yes I have used read.table(file name, sep=\t) for reading the text file Thank you On Thu, May 14, 2009 at 11:07 PM, jim holtman jholt...@gmail.com wrote: What have you tried? Check the Intro manual for hints. ?read.table probably using sep='\t' On Thu, May 14, 2009 at 1:30 PM,

Re: [R] Histogram + % of cases for a given criteria

2009-05-14 Thread S. Nunes
Hi, Thanks for the contribution. I tested the code but I got a couple or errors. I'll try to debug these in the next days. Maybe there is a simpler approach to what I am trying to do. I have a bunch of measures and a column with the success of the case (1/0). I simply want to evaluate my

Re: [R] Duplicates and duplicated

2009-05-14 Thread William Dunlap
The table()-based solution can have problems when there are very closely spaced floating point numbers in x, as in x1-c(1, 1-.Machine$double.eps, 1+2*.Machine$double.eps)[c(1,2,3,2,3)] It also relies on table(x) turning x into a factor with the default levels=as.character(sort(x)) and that

[R] Function to read a string as the variables as opposed to taking the string name as the variable

2009-05-14 Thread Lori Simpson
I am writing a custom function that uses an R-function from the reshape package: cast. However, my question could be applicable to any R function. Normally one writes the arguments directly into a function, e.g.: result=cast(table1, column1 + column2 + column3 ~column4, mean)

[R] KNN script: Identity of specific K samples chosen?

2009-05-14 Thread Ryan van Laar
I am currently doing some prediction work using the knn script in the 'class' package. Does anyone know a way of having R return the IDs (sample IDs, or column IDs of the training matrix) of the 'k' samples that are chosen by the algorithm as being nearest to a given test sample? I have

Re: [R] Function to read a string as the variables as opposed to taking the string name as the variable

2009-05-14 Thread hadley wickham
On Thu, May 14, 2009 at 12:16 PM, Lori Simpson lori.simp...@dc-energy.com wrote: I am writing a custom function that uses an R-function from the reshape package: cast.  However, my question could be applicable to any R function. Normally one writes the arguments directly into a function,

Re: [R] [OT?]R Reference Manual review/recommend

2009-05-14 Thread John Kane
I don't know the book but I doubt that it is a good way to learn R. I'd suggest having a look at some of the documentation available on the R site. Click on Other (in left column of page) have a look there and then select the contributed documentation link to get more documentation. Have

  1   2   >