Re: [R] get mean from cdf

2011-09-08 Thread peter dalgaard
On Sep 9, 2011, at 03:51 , Jeff Newmiller wrote: > The diff function would be helpful. ...or not: > sum(ppois(0:1000, lambda=2.345, lower=F)) [1] 2.345 (if this was homework: the hard bit is to figure out _why_ this works.) > annie Zhang wrote: > > Hi All, > > How can I get the expected v

Re: [R] get mean from cdf

2011-09-08 Thread Bert Gunter
Sigh Homework? -- Bert On Thu, Sep 8, 2011 at 6:47 PM, annie Zhang wrote: > Hi All, > > How can I get the expected value from a discrete cdf? Is there any R > function that can do this? > > Thanks, > Annie > >        [[alternative HTML version deleted]] > > __

Re: [R] Wilcox test

2011-09-08 Thread Jorge I Velez
Hi Chintau, For A, try # some data set.seed(123) X <- matrix(rnorm(1013*6), ncol = 6) group <- rep(0:1, each = 3) # option 1 result <- apply(X, 1, function(x) wilcox.test(x ~ group, paired = TRUE)$p.value) result # option 2 res <- rep(NA, NROW(X)) for(i in 1:NROW(X)){ res[i] <- wilcox.

[R] Wilcox test

2011-09-08 Thread Chintanu
Hi, Two queries, if I may ask: A. I wish to retrieve the p-values from wilcox test for EACH gene --- such that Samples 1-3 is considered as one group while the rest remains in the other group. There is 1013 genes in the dataframe as attempted to exemplify in the table below.

Re: [R] Passing in Condtions into Object

2011-09-08 Thread Daniel Malter
Would: tapply(mpg,list(year,manufacturer), function(x) length(unique(x))) do what you are trying to accomplish? Or do you need very specific subsets? If so, you can do: year<-c(rep(1980,4),rep(1981,4)) manufacturer<-rep(c('A','B'),4) mpg<-sample(c(1:2),8,replace=T) guc<-function(x,y,z){length(u

[R] RExcel - RunRFile Errors

2011-09-08 Thread kball_ea
Hi, I am using RExcel and trying to pass a line of code into R. When I select the cell and choose "Run Code" from the RExcel menu then it seems to work fine. The problem I face is a need to write a macro to do this operation, as I need to set up a user interface in excel for other users who don't

Re: [R] Passing in Condtions into Object

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 8:21 PM, Adam Pridgen wrote: Hello, I am trying to pass a conditional expression into an expression to be evaluated when ever an R statement is called. For example: get_unique_count <- function(df, select, field){ uniqs <- unique(subset(df, select)[field]) return (nrow

[R] envfit vector labels with ordiplot3d

2011-09-08 Thread Briony
Hi R experts, I'm looking for some help with plotting vectors from envfit in vegan, onto a 3d plot using ordiplot3d. So far I have data.mds <- metaMDS(data, k=3,trace = FALSE) vect_data<-envfit(data.mds,vegdata[,3:21],choices=1:3,permu=) ordiplot3d(data.mds,envfit=vect_data) ordixyplot(data.m

[R] Passing in Condtions into Object

2011-09-08 Thread Adam Pridgen
Hello, I am trying to pass a conditional expression into an expression to be evaluated when ever an R statement is called. For example: get_unique_count <- function(df, select, field){ uniqs <- unique(subset(df, select)[field]) return (nrow(uniqs)) } In this case select is a conditional

[R] Classification from candisc

2011-09-08 Thread adigs
This is a probably a daft question, but I would appreciate some help. I want to attempt to separate groups in a dataset using discriminant function analysis, and have been using linear discriminant analysis (lda(klaR)) and canonical discriminant analysis (candisc(candisc)). # CDA: iris.mod <- lm(

Re: [R] get mean from cdf

2011-09-08 Thread Jeff Newmiller
The diff function would be helpful. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Contro

[R] get mean from cdf

2011-09-08 Thread annie Zhang
Hi All, How can I get the expected value from a discrete cdf? Is there any R function that can do this? Thanks, Annie [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] random sampling but with caveats!

2011-09-08 Thread Jean-Christophe BOUËTTÉ
Hi there, It seems you got no answer. Maybe providing a reproducible example would help, as well as expressing your problem in more general terms. I am not an expert in sampling, but I would suggest (as does the help for sample) that you take a look at the sampling package, available on CRAN, and t

Re: [R] Factors? I think?

2011-09-08 Thread Rolf Turner
On 09/09/11 11:36, Totally Inept wrote: First of all, let me apologize, as this is probably an absurdly basic question. I did search before asking, but perhaps my ineptitude didn't allow me to apply what I read to what I'm doing. Totally new to R, and haven't done any code in any language in a lo

Re: [R] Factors? I think?

2011-09-08 Thread R. Michael Weylandt
It's probably easiest to think of this as a compound map (doctor -> dept code -> factor -> character -> integer -> dept code -> dept name as character) and to treat the code as such: if you already have R objects with the codes in them, it shouldn't be hard to do the transformation. Consider the f

[R] Factors? I think?

2011-09-08 Thread Totally Inept
First of all, let me apologize, as this is probably an absurdly basic question. I did search before asking, but perhaps my ineptitude didn't allow me to apply what I read to what I'm doing. Totally new to R, and haven't done any code in any language in a long time. Basically I've got categories. T

Re: [R] Plotting question

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 6:38 PM, Andra Isan wrote: Hi All, I am plotting different lines in my graph and the problem I have is that if the first plot has smaller y value than the second plot, I will not be able to see the the top part of the graph. I do the following:plot(p1, avg="vertical", l

[R] Plotting question

2011-09-08 Thread Andra Isan
Hi All,  I am plotting different lines in my graph and the problem I have is that if the first plot has smaller y value than the second plot, I will not be able to see the the top part of the graph. I do the following:plot(p1, avg="vertical", lwd=3, col="red", main ="all graphs")plot(p2, avg="ve

Re: [R] OT was Re: The elegant way to test if a number is a whole number

2011-09-08 Thread Seeliger . Curt
Oh now wait a minute. If THATs considered old, what's next -- punch cards? CDs? cur - who knows the answers to that question and accepts the mantle of authority conferred by time, though he may not actually live up to it. > From: Marc Schwartz > > Oh I knew that Carl?still "ST". > > I am o

Re: [R] OT was Re: The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
Oh I knew that Carl…still "ST". I am old enough to have watched STTOS when it first aired in 66 and did. I'll leave it at that, as we stray further OT… :-) Regards, Marc On Sep 8, 2011, at 5:12 PM, Carl Witthoft wrote: > Unfortunately for the attribution, "Make it so" is from STTNG, not STT

[R] OT was Re: The elegant way to test if a number is a whole number

2011-09-08 Thread Carl Witthoft
Unfortunately for the attribution, "Make it so" is from STTNG, not STTOS. This correction brought to you by the husband of a major Trekker-nerd. >>> Seems like the most appropriate way now. I'll make it so! > > Very apropos on the 45th anniversary of Star Trek. :-) > >>> Thanks for your help

Re: [R] Can't load workspaces

2011-09-08 Thread Monsieur Do
Hi Gene, Your cue to the profile was right. This line in my .Rprofile is the culprit: makeActiveBinding(".",function() .Last.value,env=.GlobalEnv) It's unfortunate, because I really like that feature (typing . to get the value returned by the last executed command).  Thanks Dominic > Are you

Re: [R] Spider (Radar) Plot

2011-09-08 Thread Dennis Murphy
# install.packages('sos') library(sos) findFn('radar plot') gets 29 hits on my system. The two that seem to be the most relevant are radarchart() from the fmsb package and, as mentioned in the other reply, stars() from the autoloaded graphics package. BTW, read the quoted text and observe how you

Re: [R] Searching the console

2011-09-08 Thread Gene Leynes
searchhist = function(pattern){ histfile = tempfile() savehistory(histfile) myHist = readLines(file(histfile)) ret = myHist[grep(pattern, myHist)] return(ret) } searchhist('data') searchhist('^lm') searchhist('hist') On Thu, Sep 8, 2011 at 12:03 AM, andrewH wrote: > Is there

Re: [R] help subsetting data based on date AND time

2011-09-08 Thread MacQueen, Don
Steve, Just below are some examples that I hope will help. With regard to what you've tried, I don't see any reason for using with(), or the select argument to subset(). They both look unnecessary to me. ## examples of subsetting date-time values ## create fake data tmp <- seq(as.POSIXct('2011-0

Re: [R] Searching the console

2011-09-08 Thread Duncan Murdoch
On 11-09-08 2:21 PM, andrewH wrote: Dear Sarah-- I am thinking mainly in terms of long programs run by cut-and-past or some other batch-like submission, where you can get back a lot of code, some program outputs, and some error messages, all in a big lump. I want tl look through that lump to lo

Re: [R] problem with math expressions in grid graphics when using line breaks (\n)

2011-09-08 Thread Dennis Murphy
>From the plotmath help page: "Control characters (e.g. \n) are not interpreted in character strings in plotmath, unlike normal plotting." In other words, "you can't do that". However, since you're using grid graphics, this thread from the ggplot2 group might be helpful: http://groups.google.com

Re: [R] Can't load workspaces

2011-09-08 Thread Gene Leynes
Are you doing something in your profile.site file or loading a package that masks "load"? It seems that you're deparsing (or parsing, I can never remember which is which) the literal results of the load function. Does it work if you do this? save(a, file='a.RData') On Thu, Sep 8, 2011 at 12:24

Re: [R] Rweb and setting up R on a server

2011-09-08 Thread Matt Shotwell
Erin, I haven't used Rweb recently. The URL is http://www.math.montana.edu/Rweb/ . If you have a server, you could set up the server version of RStudio: http://rstudio.org/download/server . It worked well when I tried it. Best, Matt On Tue, 2011-09-06 at 17:07 -0500, Erin Hodgess wrote: > Dea

Re: [R] General help - online statistics courses?

2011-09-08 Thread Rolf Turner
On 09/09/11 06:46, Spencer Graves wrote: I'd rather ask a stupid question than make a stupid mistake. Fortune? cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 4:41 PM, Marc Schwartz wrote: On Sep 8, 2011, at 3:09 PM, David Winsemius wrote: On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrie

Re: [R] Can't load workspaces

2011-09-08 Thread Rolf Turner
Your example works without error for me; R version 2.13.1 Patched on Ubuntu Linux. No idea why you are having problems. cheers, Rolf Turner On 09/09/11 05:24, Monsieur Do wrote: > I've seen a number of issues with the loading of workspaces discussed > previously, but here's

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
On Sep 8, 2011, at 3:09 PM, David Winsemius wrote: > > On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: > >> >> On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: >> >>> >>> On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: >>> Am 08.09.2011 20:48, schrieb Marc Schwartz: > Th

Re: [R] Spider (Radar) Plot

2011-09-08 Thread Jean-Christophe BOUËTTÉ
Both ??radar and ??spider return ?stars. 2011/9/8 XINLI LI : > Dear R Group: > >   Based on the following data, how to do a great Spider (Radar) Plot? Any > advice is greatly appreciated. > >     HospID Rate Age Charlson NIHSS 1 0.2 49 3.5 0 2 0.1 48 1.8 12 3 0.4 56 > 2.1 5 4 0.3 77 0 7 5 0.2 67 6

Re: [R] help subsetting data based on date AND time

2011-09-08 Thread Luke Miller
Try altering your subset operation from this: with(DataSet, subset(DataSet, DataSet$NewDateTime < '2004-08-05 14:15:00')) to this: with(DataSet, subset(DataSet, DataSet$NewDateTime < as.POSIXct('2004-08-05 14:15:00'))) and see if you get the desired effect. The statement DataSet$NewDateTime <

Re: [R] ggplot2 freqpoly() layers..?

2011-09-08 Thread Dennis Murphy
Hi: You could try something like this: # rbind the two melted data frames: comb <- rbind(mat2, tab2) # create a group factor to distinguish the two data sets comb <- mutate(comb, gp = factor(rep(1:2, each = 1))) # Generate the plot: ggplot(comb) + geom_freqpoly(aes(x = value, y = ..dens

[R] Spider (Radar) Plot

2011-09-08 Thread XINLI LI
Dear R Group: Based on the following data, how to do a great Spider (Radar) Plot? Any advice is greatly appreciated. HospID Rate Age Charlson NIHSS 1 0.2 49 3.5 0 2 0.1 48 1.8 12 3 0.4 56 2.1 5 4 0.3 77 0 7 5 0.2 67 6.5 3 6 0.1 62 4.8 4.6 7 0.1 64 12 5.2 8 0.3 61 3 2.8 9 0.15 69 4.5 1.9 1

[R] help subsetting data based on date AND time

2011-09-08 Thread Steve E.
Dear R Community, I am new to R, and have a question that I suspect may be quite simple but is proving a formidable roadblock for me. I have a large data set that includes water-quality measurements collected over many 24-hour periods. The date and time of sample collection are in a combined Dat

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Ista Zahn
On Thu, Sep 8, 2011 at 12:10 PM, Brian Smith wrote: > Hi, > > Thanks for the reply. For the combined plot, if I use: > >     ggplot(comb2) + geom_freqpoly(aes(x = value, >                     y = ..density.., group = X2)) > > > I get the same colour for both the sets of distributions. That is bec

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin Maechler some years ago and I had to search a bit to find

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: > > On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: > >> Am 08.09.2011 20:48, schrieb Marc Schwartz: >> > There was a post from Martin Maechler some years ago and I had to search a >> > bit to find it. For these sorts of issues, I typi

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: > There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. > > The post is here: > >https://

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Alexander Engelhardt
Am 08.09.2011 20:48, schrieb Marc Schwartz: > There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. > > The post is here: > >https://stat.ethz.ch/pipermail/r-help/2003-April/032471.html > > His

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. The post is here: https://stat.ethz.ch/pipermail/r-help/2003-April/032471.html His solution also handles complex numbers. HTH, Marc Schwartz

Re: [R] General help - online statistics courses?

2011-09-08 Thread Spencer Graves
Have you looked at www.r-project.org -> books? Also, "www.r-project.org -> CRAN (select a mirror) -> Documentation: Contributed" includes a variety of documents that are free and potentially quite helpful. Also, I wouldn't be shy about asking co-workers for suggestions. (I'd ra

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Bert Gunter
Have a close look at ?storage.mode and ?typeof. The problem here, as usual and as you seem to allude is: define "integer" . Mathematically, there is an unequivocal definition, but not so in finite precision arithmetic. Are you referring to the machine representation (typeof()), or the approximate

Re: [R] ggplot2-Issue placing error bars behind data points

2011-09-08 Thread Nathan Miller
Jeff Newmiller and Dennis, As always, very helpful. I appreciate the comments on how best to organize the code as well. Simplifies things greatly. Thanks, Nate On Wed, Sep 7, 2011 at 3:33 PM, Dennis Murphy wrote: > Hi: > > For your test data, try this: > > # Result of dput(NerveSurv) > NerveSu

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread peter dalgaard
On Sep 8, 2011, at 19:03 , Albyn Jones wrote: > Look at > >area <- sum(a$y)*(a$x[1]-a$y[2]) > > The problem appears to be "a$x[1]-a$y[2]"; that is not the length of > the base of an approximating rectangle, whatever it is :-) I would assume that that is just a typo for a$x[1]-a$x[2], which

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Jason Morgan
Hello Alex, Have you tried the modulus operator? > 2 %% 1 [1] 0 > 2.1 %% 1 [1] 0.1 ~Jason On 2011.09.08 20:27:14, Alexander Engelhardt wrote: > Hi, > > x <- 0.2*5 > is.integer(x) > > gives me FALSE because R stores it as a float number, right? > Is there an elegant way to work aroun

Re: [R] Searching the console

2011-09-08 Thread andrewH
Thanks Eik! I did not know about or remember history. I agree that it solves part of my problem, but I really want to be able to search my code and the things R has printed in response as a single block of text. I can cut-and-paste it into a text editor, but I was hoping that there was a way to do

Re: [R] rpart/tree issue

2011-09-08 Thread Stephen Milborrow
"Brian Jensvold" het geskryf I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I get is a weird decimal val

[R] The elegant way to test if a number is a whole number

2011-09-08 Thread Alexander Engelhardt
Hi, x <- 0.2*5 is.integer(x) gives me FALSE because R stores it as a float number, right? Is there an elegant way to work around that problem? Right now I'm using x <- 0.2*5 round(x) == x which returns TRUE. But more strictly I should use all.equal(), right? I somehow just don

Re: [R] Searching the console

2011-09-08 Thread andrewH
Dear Sarah-- I am thinking mainly in terms of long programs run by cut-and-past or some other batch-like submission, where you can get back a lot of code, some program outputs, and some error messages, all in a big lump. I want tl look through that lump to locate all the error or warning messages

Re: [R] General help - online statistics courses?

2011-09-08 Thread Mitchell Maltenfort
Also, look at ocw.mit.edu for free course notes with statistical content. On 9/8/11, kensuguro wrote: > I understand this isn't a r specific question. I'm switching departments to > work with the analytics team at my company as a "service" side manager to > better incorporate the analytics proce

Re: [R] General help - online statistics courses?

2011-09-08 Thread Mitchell Maltenfort
My approach has been autodidactic. There's a bookstore near me (Barnes and Noble at U of Penn) that has a terrific stats section. Amazon also has a lot of books, including limited online browsing + reader recommendations. On 9/8/11, kensuguro wrote: > I understand this isn't a r specific question

[R] General help - online statistics courses?

2011-09-08 Thread kensuguro
I understand this isn't a r specific question. I'm switching departments to work with the analytics team at my company as a "service" side manager to better incorporate the analytics process into product design / production. We're an online gaming company. As I'm going through tools like R, rapi

[R] random sampling but with caveats!

2011-09-08 Thread Rebecca Ross
Hi, I wonder if someone can help me. I have built a gam model to predict the presence of cold water corals and am now trying to evaluate my model by splitting my dataset into training/test datasets. In an ideal world I would use the sample() function to randomly select rows of data for me so fo

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Jean-Christophe BOUËTTÉ
Is your "data" supposed to be observations, or values of the density of the underlying law? Also, could you explain the rationale behind : sum(a$y)*(a$x[1]-a$y[2]) because it is not immediately clear to the reader. 2011/9/8 Gonçalo Ferraz : > Hi, I have a vector 'data' of 58 probability values (b

Re: [R] pie chart

2011-09-08 Thread Jean V Adams
Mohan L wrote on 09/08/2011 12:35:18 PM: > > Hi All, > > I have txt file like : > > $ cat data.txt > US 10 > UK 12 > Ind 4 > Germany 14 > France 8 > > > rawdata <- read.table(file='data.txt',sep='\t' , header=FALSE) > > > rawdata >V1 V2 > 1 US 10 > 2 UK 12 > 3 I

[R] pie chart

2011-09-08 Thread Mohan L
Hi All, I have txt file like : $ cat data.txt US 10 UK 12 Ind 4 Germany 14 France 8 > rawdata <- read.table(file='data.txt',sep='\t' , header=FALSE) > rawdata V1 V2 1 US 10 2 UK 12 3 Ind 4 4 Germany 14 5 France 8 I want to draw pie chart for the above dat

[R] Can't load workspaces

2011-09-08 Thread Monsieur Do
I've seen a number of issues with the loading of workspaces discussed previously, but here's another one... I simply can't load any saved workspace at all... Here's an example, starting with an empty workspace and creating a single variable "a". > a<-1:5 > save.image("a.Rdata") > rm(a) > load

[R] problem with math expressions in grid graphics when using line breaks (\n)

2011-09-08 Thread Mark Heckmann
I want to plot a multiline annotation including a mathematical expression using grid graphics (grid.text). This works fine for a single line, but the math expression is misplaced when I insert a line break ("\n" escape sequence): grid.text(expression(paste("Some words here\n more ", sigma))) Do

Re: [R] Hysteresis modeling and simulation

2011-09-08 Thread Bill Harris
On Mon, Sep 5, 2011 at 12:25 AM, Yvonnick Noel wrote: > Hi Bill, > > I once modelled a hysteresis phenomenon (on binary data) with a simple > logistic model. I am not sure I understand how this pattern appears in your > data, but in my previous analyses, it appeared as an order effect: The > resp

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Albyn Jones
Look at area <- sum(a$y)*(a$x[1]-a$y[2]) The problem appears to be "a$x[1]-a$y[2]"; that is not the length of the base of an approximating rectangle, whatever it is :-) albyn On Thu, Sep 08, 2011 at 11:36:23AM -0400, Gonçalo Ferraz wrote: > Hi, I have a vector 'data' of 58 probability value

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Greg Snow
For bounded density estimation look at the logspline package instead of the regular density function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] storage and single-precision

2011-09-08 Thread Duncan Murdoch
On 08/09/2011 11:14 AM, Mike Miller wrote: On Thu, 8 Sep 2011, Duncan Murdoch wrote: > On 11-09-07 6:25 PM, Mike Miller wrote: > >> I'm getting the impression from on-line docs that R cannot work with >> single-precision floating-point numbers, but that it has a pseudo-mode >> for single pre

Re: [R] Need formatting help - ctree - plot.party - node_hist

2011-09-08 Thread Carlos Ortega
Hi, You can get something better in this way: plot(mtree,terminal_panel=node_barplot(mtree, ylines=1.2, gap=0.05)) Check node_barplot() for details, although it does not offer for barplots the possibility to graph it horizontally. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8,

Re: [R] global optimisation with inequality constraints

2011-09-08 Thread Carlos Ortega
Hi, I think this other post could help: http://stackoverflow.com/questions/7328104/optim-with-inequality-constraint Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8, 2011 at 3:54 PM, Liu Evans, Gareth < gareth.liu-ev...@liverpool.ac.uk> wrote: > Dear All, > > I would like to minimi

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Brian Smith
Hi, Thanks for the reply. For the combined plot, if I use: ggplot(comb2) + geom_freqpoly(aes(x = value, y = ..density.., group = X2)) I get the same colour for both the sets of distributions. What I want is one colour for the first set of distributions, and a different c

Re: [R] "rpart" or "tree" function issue

2011-09-08 Thread Carlos Ortega
Hi, Use packages "rpart.plot" or "maptree" to enhance the tree drawing. Or another alternative, use "party" package that offers much more graphing possibilities. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8, 2011 at 5:27 PM, Brian Jensvold wrote: > I am trying to create a cla

Re: [R] storage and single-precision

2011-09-08 Thread Mike Miller
On Thu, 8 Sep 2011, William Dunlap wrote: Use gzcon() to make a compressed connection and any function that write to a connection will write compressed data. E.g., > con <- gzcon(file("tempfile.junk", "wb")) > x <- as.integer(rep(c(-127, 1, 127), c(3,2,1))) > writeBin(x, con, size=1) > cl

Re: [R] problems with function read.table

2011-09-08 Thread Carlos Ortega
Hi, If you read carefully the help pages for read.table you get this: na.stringsa character vector of strings which are to be interpreted as NA<../../utils/help/NA> values. Blank fields are also considered to be missing values in logical, integer, numeric and complex fields. So, both NAs and bl

Re: [R] Variable scoping question

2011-09-08 Thread William Dunlap
In my.ls() you ought to convert the pos argument to an environment and consistently use that environment in the calls to eval, get, and ls in the function. E.g., with the following modification my.ls1 <- function (pos = 1, sorted = FALSE, envir = as.environment(pos)) { .result <- sapply(ls(env

Re: [R] storage and single-precision

2011-09-08 Thread William Dunlap
Use gzcon() to make a compressed connection and any function that write to a connection will write compressed data. E.g., > con <- gzcon(file("tempfile.junk", "wb")) > x <- as.integer(rep(c(-127, 1, 127), c(3,2,1))) > writeBin(x, con, size=1) > close(con) > q("no") bill:158% zcat temp

[R] "rpart" or "tree" function issue

2011-09-08 Thread Brian Jensvold
I am trying to create a classification tree using either tree or rpart functions but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials (like http://www.youtube.com/watch?v=9XNhqO1bu0A or http://www.youtube.com/watch?v=m3mLNpeke0I&feature=re

[R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Gonçalo Ferraz
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands: data <- runif(58) a <- density(data, from=0, to=1) plot(a, type="l",lwd=3) But then, when I try to approximate the area

Re: [R] predict.rma (metafor package)

2011-09-08 Thread Viechtbauer Wolfgang (STAT)
Hello Andrew, Take a look at the following: predict(model1, addx=T) predict(model2, addx=T) predict(model3, addx=T) As you can see, the factor was turned into dummy variables. However, the predict.rma() function does not expand a factor passed via newmods into the corresponding dummy variables

Re: [R] Variable scoping question

2011-09-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of jim holtman > Sent: Thursday, September 08, 2011 6:52 AM > To: Bos, Roger > Cc: r-help@r-project.org > Subject: Re: [R] Variable scoping question > > Here is a function I use to

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Ista Zahn
Hi Brian On Thu, Sep 8, 2011 at 10:30 AM, Brian Smith wrote: > Hi, > > I was trying to overlay/combine two freqpoly plots. The sample code below > illustrates the problem. Essentially, I want to do is: > > 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2'). Then don't map the c

[R] ggplot2 freqpoly() layers..?

2011-09-08 Thread Tim Smith
Hi, I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is: 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2'). Currently, all the lines in Plot 1 have different colours and all the lines in Plot 2 have

Re: [R] randomForest memory footprint

2011-09-08 Thread John Foreman
I set maxnodes and nodesize to reasonable levels and everything is working great now. Thanks for the guidance. v/r, John On Thu, Sep 8, 2011 at 8:58 AM, Liaw, Andy wrote: > It looks like you are building a regression model.  With such a large number > of rows, you should try to limit the size o

Re: [R] storage and single-precision

2011-09-08 Thread Mike Miller
On Thu, 8 Sep 2011, Duncan Murdoch wrote: On 11-09-07 6:25 PM, Mike Miller wrote: I'm getting the impression from on-line docs that R cannot work with single-precision floating-point numbers, but that it has a pseudo-mode for single precision for communication with external programs. I don'

[R] problems with function read.table

2011-09-08 Thread Samir Benzerfa
Hello everyone I have a couple of questions about the usage of the R function "read.table(.)". My point of departure is that I want to import a matrix (consisting of time and daily stock returns of many stocks) in R. Most of the data is numeric, however some values are missing (blanks) and in o

[R] Need formatting help - ctree - plot.party - node_hist

2011-09-08 Thread Warren W. Kretzschmar
Hi, I am trying to get the terminal nodes of a plot of a ctree object to look nice. Using the iris data I have: library(party) mtree <- ctree(Species ~ ., data=iris) plot(mtree,terminal_panel=node_barplot(mtree)) The terminal nodes don't display the species names because the names are displayed

Re: [R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread Jean-Christophe BOUËTTÉ
have a look at ?formula and the examples 2011/9/8 Bos, Roger : > I have a matrix called mat and y is the column number of my response and > x is a vector of the column numbers of my terms.  The variable name of y > can change, so I don't want to hardcode it.  I can find out the name as > follows:

[R] global optimisation with inequality constraints

2011-09-08 Thread Liu Evans, Gareth
Dear All, I would like to minimise a nonlinear function subject to linear inequality constraints as part of an R program. I have been using the constrOptim function. I have tried all of the methods that come with Optim, but nothing finds the correct solution. If I use the correct solution as

[R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Brian Smith
Hi, I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is: 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2'). Currently, all the lines in Plot 1 have different colours and all the lines in Plot 2 have dif

Re: [R] Imposing Feller condition using project constraint in spg

2011-09-08 Thread Ravi Varadhan
Hi Kristian, The idea behind projection is that you take an iterate that violates the constraints and project it onto a point such that it is the nearest point that satisfies the constraints. Suppose you have an iterate (w1, w4) that does not satisfy the constraint that w1 * w4 != (1 + eps)/2.

Re: [R] rpart/tree issue

2011-09-08 Thread Terry Therneau
-- begin included message -- I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I get is a weird decimal value.

Re: [R] 3D plot RGL

2011-09-08 Thread Jean V Adams
francogrex wrote on 09/08/2011 08:08:19 AM: > > Hi, anyone has experience with 3D plot (ex: in package RGL) I have a > question, I draw a 3D plot of country, year and sales in z axis but when the > type is "h" then it's ok but when I want to link the points and type is 'l' > lines it's a mess Is

Re: [R] Variable scoping question

2011-09-08 Thread jim holtman
Here is a function I use to look at the sizes of objects: my.ls <- function (pos = 1, sorted = FALSE) { .result <- sapply(ls(pos = pos, all.names = TRUE), function(..x) object.size(eval(as.symbol(..x if (sorted) { .result <- rev(sort(.result)) } .ls <- as.data.frame(rbi

Re: [R] suggestion for proportions

2011-09-08 Thread csrabak
Em 8/9/2011 05:24, Viechtbauer Wolfgang (STAT) escreveu: I assume you mean Cohen's kappa. This is not what the OP is asking about. The OP wants to know how to test for a difference in the proportions of 1's. Cohen's kappa will tell you what the level of agreement is between the two tests. This is

Re: [R] Variable scoping question

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 9:13 AM, Bos, Roger wrote: I modified an example in the object.size help page to create a function I want to be able to run: "mysize" <- function() { z <- sapply(ls(), function(w) object.size(get(w))) as.matrix(rev(sort(z))[1:5]) } mysize() When I test the lines ins

Re: [R] How to specify a variable name in the regression formula without hard coding it SOLVED

2011-09-08 Thread Bos, Roger
The answer to my question was : fmla <- as.formula(names(mat)[y] %+% " ~ .") mod <- try(rlm(fmla, data=mat[zidx, c(y, x)]), silent=TRUE) Thanks for your help and the quick response. Roger -Original Message- From: Jean-Christophe BOUËTTÉ [mailto:jcboue...@gmail.com] Sent: Thursday, Sep

Re: [R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 9:03 AM, Bos, Roger wrote: I have a matrix called mat and y is the column number of my response and x is a vector of the column numbers of my terms. The variable name of y can change, so I don't want to hardcode it. I can find out the name as follows: name

Re: [R] Extract r.squared using cbind in lm

2011-09-08 Thread Petr PIKAL
Hi > > Hello, > > I am using cbind in a lm-model. For standard lm-models > the r.squared can be easily extracted with summary(model)$r.squared, > but that is not working in in the case with cbind. > > Here an example to illustrate the problem: > a <- c(1,3,5,2,5,3,1,6,7,2,3,2,6) > b <- c(12,15,

[R] Variable scoping question

2011-09-08 Thread Bos, Roger
I modified an example in the object.size help page to create a function I want to be able to run: "mysize" <- function() { z <- sapply(ls(), function(w) object.size(get(w))) as.matrix(rev(sort(z))[1:5]) } mysize() When I test the lines inside the function it works fine: > z <- sapply

Re: [R] Extract r.squared using cbind in lm

2011-09-08 Thread peter dalgaard
On Sep 8, 2011, at 14:53 , Johannes Radinger wrote: > Hello, > > I am using cbind in a lm-model. For standard lm-models > the r.squared can be easily extracted with summary(model)$r.squared, > but that is not working in in the case with cbind. > > Here an example to illustrate the problem: > a

[R] 3D plot RGL

2011-09-08 Thread francogrex
Hi, anyone has experience with 3D plot (ex: in package RGL) I have a question, I draw a 3D plot of country, year and sales in z axis but when the type is "h" then it's ok but when I want to link the points and type is 'l' lines it's a mess Is there a way to link the points only in one direction? Fo

[R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread Bos, Roger
I have a matrix called mat and y is the column number of my response and x is a vector of the column numbers of my terms. The variable name of y can change, so I don't want to hardcode it. I can find out the name as follows: >names(mat)[y] [1] "er12.l" Then I can run the regression

  1   2   >