[R] boxplot colors

2008-06-22 Thread Paul Adams
Hello everyone, I am trying to color two boxplots on the same graph two different colors. I have tried the following boxplot(5,1:19,5,20:39,col=c(red,blue)) but all I get are two blue boxes. Any help would be appreciated Paul [[alternative HTML version deleted]]

[R] Re move row.names column in dataframe

2008-06-22 Thread tonyxv
Hello, aa-c(1,1,2,2,3,3,4,4,5,5,6,6) bb-c(56,56,33,33,53,53,20,20,63,63,9,9) cc-data.frame(aa,bb) uniquedf - unique(cc) View(uniquedf) Why does the column row.names appear in the new dataframe and how do I get rid of it. uniquedf$row.names - NULL does not seem to work. For what I'm doing

[R] passing arguments to a function problem

2008-06-22 Thread Jiří Voller
Dear R-users, is there some way how to pass various colnames to the following code for sorting data.frames? mydf.ordered-with(mydf, mydf[order(colname1,colname2, colnameX, decreasing = TRUE), ]) I was trying something like Afunction-function (mydf,colnames,decreasing=T){

Re: [R] Adding columns of Aggregates to existing dataframe

2008-06-22 Thread tonyxv
Thanks. ave() is the exact function I was after. tonyxv wrote: Hello, I have a dataframe ID1 ID2 A1B3 A1B4 A1B3 A1B3 A2B1 A2B1 A2B4 A3B2 A3B2 A5B1 A5B1 A5B6 A5B4 A6B2 I want to add extra columns to the

Re: [R] Re move row.names column in dataframe

2008-06-22 Thread Bill.Venables
- There is no column in the data frame called row.names. It only looks that way when you use the viewer. - All data frames must have row and column names. This is not negotiable. Also, the row.names will not interfere with any merging operation because they are not a column of the data frame:

Re: [R] boxplot colors

2008-06-22 Thread HBaize
You are drawing four box plots, not two. Two of them are just the number 5. The two box plots that are only 5 don't have a box, so you can't see that they're red. Try this: boxplot(1:19,20:39,col=c(red,blue)) Paul Adams-8 wrote: Hello everyone, I am trying to color two boxplots on the

Re: [R] R vs. Bugs

2008-06-22 Thread Prof Brian Ripley
Your request is too vague for us to be very helpful. However OpenBUGS runs without very frequent crashes only on some ix86 Linux machines -- and what those are is unclear and Uwe Ligges and I (working on BRugs) have been unable to find one recently. There are dozens of Bayesian MCMC packages

[R] I can't see plots

2008-06-22 Thread Josep Lluís Figueras
Hi, I use RSPerl on Ubuntu and Apache2 web server. It is my first experience with R language :-) I have the next code embedded into a Perl CGI: use R; use RReferences; my @x; R::initR(--silent,--no-save); R::library(RSPerl); @x = R::call(rnorm, 10); R::call(plot, [EMAIL PROTECTED]); The CGI

[R] No HTML package list update in 2.7.0?

2008-06-22 Thread Jim Lemon
Hi all, As I was uploading a couple of little fixes to prettyR, I remembered that there was a question I wanted to ask. I remember the package list being updated whenever I installed a new package (at least on Linux, oh yes, Fedora Core 9 now), but not on Windows (I just used to unzip the packages

[R] I can't see plots

2008-06-22 Thread Josep Lluís Figueras
Hi, I am using RSPerl package on Ubuntu and Apache2 web server. It is my first experience with R language :-) I have the next code embedded into a Perl CGI: use R; use RReferences; my @x; R::initR(--silent,--no-save); R::library(RSPerl); @x = R::call(rnorm, 10); R::call(plot, [EMAIL

Re: [R] passing arguments to a function problem

2008-06-22 Thread Gabor Grothendieck
See orderBy in the doBy package. On Sat, Jun 21, 2008 at 7:58 PM, Jiří Voller [EMAIL PROTECTED] wrote: Dear R-users, is there some way how to pass various colnames to the following code for sorting data.frames? mydf.ordered-with(mydf, mydf[order(colname1,colname2, colnameX, decreasing =

Re: [R] No HTML package list update in 2.7.0?

2008-06-22 Thread Jonathan Baron
See https://bugzilla.redhat.com/show_bug.cgi?id=442727 Right now I seem to be using /usr/share/doc/R-2.7.0/html to get the list (on finzi.psych.upenn.edu) On 06/22/08 20:43, Jim Lemon wrote: Hi all, As I was uploading a couple of little fixes to prettyR, I remembered that there was a

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Bryan Hanson
Below is a revised set of code that demonstrates my question a little more clearly, I hope. When plotting all the data (5th panel), col sym don't seem to be passed correctly, as the (random) first value for col sym are used for all points (run the code, then run it again, you'll see how the 5th

Re: [R] I can't see plots

2008-06-22 Thread Duncan Murdoch
Josep Lluís Figueras wrote: Hi, I am using RSPerl package on Ubuntu and Apache2 web server. It is my first experience with R language :-) I have the next code embedded into a Perl CGI: use R; use RReferences; my @x; R::initR(--silent,--no-save); R::library(RSPerl); @x = R::call(rnorm, 10);

Re: [R] I can't see plots

2008-06-22 Thread milton ruser
Hi there, try to open a graphic device with x11(), may be. cheers, miltinho On 6/22/08, Josep Lluís Figueras [EMAIL PROTECTED] wrote: Hi, I am using RSPerl package on Ubuntu and Apache2 web server. It is my first experience with R language :-) I have the next code embedded into a Perl

Re: [R] I can't see plots

2008-06-22 Thread Daniel Cegielka
Maybe this help you http://www.rforge.net/Cairo/index.html http://www.rosuda.org/R/GDD/ daniel cegielka -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of milton ruser Sent: Sunday, June 22, 2008 5:56 PM To: Josep Lluís Figueras Cc: r-help@r-project.org

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Gabor Grothendieck
Try this: library(lattice) all$resp - as.factor(all$resp) stripplot(~ index | resp * yr, all, col = all$col, pch = all$sym, layout = c(1, 4)) On Sun, Jun 22, 2008 at 10:43 AM, Bryan Hanson [EMAIL PROTECTED] wrote: Below is a revised set of code that demonstrates my question a little more

Re: [R] R vs. Bugs

2008-06-22 Thread Peter Muhlberg
I've done some looking around in R and elsewhere to answer my question on the value of R vs. Bugs for MCMC. So, for anyone who is curious, here's what I think I've found: Bugs compiles its code, which should make it much faster than a pure R program. Packages such as AMCMC run MCMC in R,

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Bryan Hanson
Thanks Gabor, I'm getting closer. Is there a way to spread out resp values vertically for a given value of index? In base graphics, stripchart does this with method = stack. But in lattice, stack = TRUE does something rather different, and I don't see a combination of lattice arguments that

[R] Redefining the for loop

2008-06-22 Thread ast_shopping
Hi, I have the following problem: I want to redefine the for loop (or define a similar statement) to change its behavior under some circumstances. So, I would like sthg. like For = function ( var, vec, statement ) { if ( ... ) { /* my implementation of for */ } else { /* call

[R] readLines problem in iteration

2008-06-22 Thread Yasin Hajizadeh
Hi there My script at each iteration produces a .dat file which I save in a directory with write.table. Then I need to read each line of this file and create a directory for each line and put elements of that row in that directory. I do it with the following script which I have inserted

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Gabor Grothendieck
I tried it with a simple example to make it easier to check the result and it does seem we need a panel function, pnl: library(lattice) DF - data.frame(x = 1:5, col = c(1:4, 1), g = c(1, 1, 2, 2, 2), pch = c(1:3, 2:1)) pnl - function(x, y, subscripts, col, pch, ...) panel.stripplot(x, y, col =

[R] two newbie questions

2008-06-22 Thread Donald Braman
# I've tried to make this easy to paste into R, though it's probably so simple you won't need to. # I have some data (there are many more variables, but this is a reasonable approximation of it) # here's a fabricated data frame that is similar in form to mine: my.df - data.frame(replicate(10,

Re: [R] two newbie questions

2008-06-22 Thread jim holtman
This does away with the 'for' loops and uses 'expand.grid' to create the combinations. I think I got the right variables substituted: my.df - data.frame(replicate(10, round(rnorm(100, mean=3.5, sd=1 var.list - c(dv1, dv2, dv3, iv1, iv2, iv3, iv4, iv5, intv1, intv2) names(my.df) - var.list #

Re: [R] readLines problem in iteration

2008-06-22 Thread jim holtman
What is the value of 'line' on the first iteration? It appears to be undefined. You probably want something like this: while (TRUE){ line - readLines(con, n=1) if (length(line) == 0) break .your normal statements. } On Sun, Jun 22, 2008 at 3:29 PM, Yasin Hajizadeh [EMAIL

Re: [R] two newbie questions

2008-06-22 Thread Donald Braman
Wow -- many thanks for the mind-*expanding* help! I'm really impressed by R's ability to handle this so concisely It's going to take me a while to get used to applying things to vectors, but the more I understand, the nicer R looks. On Sun, Jun 22, 2008 at 6:59 PM, jim holtman [EMAIL

[R] ggplot2-barplot

2008-06-22 Thread Felipe Carrillo
Hi all: I have been using ggplot2 graphics for quite some time now and I really like it. However, I haven't used barplots enough to understand the arquitecture behind it. Can someone show me how to make this simple barplot graph with ggplot2? I want PondName along the x axis and avgWt along

Re: [R] R vs. Bugs

2008-06-22 Thread Paul Johnson
Hey, good topic for a thread. I've wrestled with this over the years. I think there's some user confusion about what WinBUGS does. People who did not see BUGS before WinBUGS tend not to understand this in the same way... The unique / important contributions from WinBUGS are the collection of

[R] Simulating Gaussian Mixture Models

2008-06-22 Thread Peng Jiang
Hi, Is there any package that I can use to simulate the Gaussian Mixture Model , which is a mixture modeling method that is widely used in statistical learning theory. I know there is a mclust, however, I think it is a little bit different from my problem. Thanks very much..

[R] problem in R for Linear mixed model~

2008-06-22 Thread Manli Yan
Dear R users: I just got confused some R code used in linear mixed model~ example,two factors,A, B,C,A is fixed ,B,C are random,and B is nested in C,if I wannt to use linear mixed model,are the following code correct for each case? case1:want to know random effect of B,

Re: [R] Simulating Gaussian Mixture Models

2008-06-22 Thread Tatiana Benaglia
Take a look at mixtools. Tatiana On Jun 22, 2008, at 9:23 PM, Peng Jiang wrote: Hi, Is there any package that I can use to simulate the Gaussian Mixture Model , which is a mixture modeling method that is widely used in statistical learning theory. I know there is a mclust, however, I

Re: [R] Simulating Gaussian Mixture Models

2008-06-22 Thread Wensui Liu
Hi, Peng, I had a piece of SAS code for 2-class gaussian mixture from my blog. You might convert it to R code. 2-Class Gaussian Mixture Model in SAS data d1; do i = 1 to 100; x = ranuni(1); e = rannor(1); y = 5 * x + e; output; end; run; data d2; do i = 1 to 100; x =

[R] Getting only label column of a data frame

2008-06-22 Thread Gundala Viswanath
Hi, How can I extract the label only from a given data frame. Fore example from this data frame. print(dataf) V1 V2 V3 V4 V5 V6 V7 V8 V9 1114514.317.131.241.745.849.868.670.672.9 3545 10.215.620.9

Re: [R] Getting only label column of a data frame

2008-06-22 Thread jim holtman
Wait. The first column is really the rowname. So you want this: row.names(x) [1] 11145 3545 8951 11097 On Sun, Jun 22, 2008 at 10:16 PM, Gundala Viswanath [EMAIL PROTECTED] wrote: Hi, How can I extract the label only from a given data frame. Fore example from this data frame.

Re: [R] problem in R for Linear mixed model~

2008-06-22 Thread Daniel Malter
Hi, random=~1|B/C C is nested in B ##Example data=Oats regress=lme(yield~nitro*Variety,data=Oats,random=~1|Block/Variety) ##i.e. variety is nested in block summary(regress) ##End of example Best, Daniel - cuncta stricte discussurus -

[R] One-to-one matching?

2008-06-22 Thread Alec.Zwart
Hi folks, Can anyone suggest an efficient way to do matching without replacement, or one-to-one matching? pmatch() doesn't quite provide what I need... For example, lookupTable - c(a,b,c,d,e,f) matchSample - c(a,a,b,d) ##Normal match() behaviour: match(matchSample,lookupTable) [1] 1 1 2 4

Re: [R] problem in R for Linear mixed model~

2008-06-22 Thread Manli Yan
Hi: Thank you very much,and for your case if I wirte as regress=lme(yield~nitro*Variety,data=Oats,random=~Variety|Block) what this mean? Regards 2008/6/22 Daniel Malter [EMAIL PROTECTED]: Hi, random=~1|B/C C is nested in B ##Example data=Oats

[R] Columnwise Alternate Subsetting of a Data Frame

2008-06-22 Thread Gundala Viswanath
Hi, Given this data frame: print(repo.dat) V1 V2 V3 V4 V5 (can be more) 1 1007_s_at DDR1 2865.1 2901.3 1978.3 300.2 2 1053_at RFC2 103.681.6 108.0 101.3 I want to split them into two data

Re: [R] Simulating Gaussian Mixture Models

2008-06-22 Thread Xiaohui Chen
First, simulate a uniform r.v on [0,1] and then cast it to binary label according to your underlying mixing probability; Second, simulate a Gaussian r.v. in above selected component. Of course, you can vecterize the two steps to simply your code. X Peng Jiang 写道: Hi, Is there any package

Re: [R] One-to-one matching?

2008-06-22 Thread Gabor Grothendieck
Try this. apseq() sorts the input and appends a sequence number: 0, 1, ... to successive occurrences of each value. Apply that to both vectors transforms it into a problem that works with ordinary match: lookupTable - c(a, a,b,c,d,e,f) matchSample - c(a, a,a,b,d) # sort and append sequence

Re: [R] One-to-one matching?

2008-06-22 Thread Moshe Olshansky
How about x - lookupTable x[!(x %in% matchSample)] - NA pmatch(matchSample,x) Regards, Moshe. --- On Mon, 23/6/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: [R] One-to-one matching? To: r-help@r-project.org Received: Monday, 23 June,

Re: [R] One-to-one matching?

2008-06-22 Thread Charles C. Berry
Or use make.unique() in place of apseq() On Sun, 22 Jun 2008, Gabor Grothendieck wrote: Try this. apseq() sorts the input and appends a sequence number: 0, 1, ... to successive occurrences of each value. Apply that to both vectors transforms it into a problem that works with ordinary

Re: [R] Columnwise Alternate Subsetting of a Data Frame

2008-06-22 Thread Moshe Olshansky
You could do something like: k - dim(repo.dat)[2] odd - seq(from=1,to=k,by=2) even - seq(from=2,to=k,by=2) even-c(1,even) df1 - repo.dat[,odd) colnames(df1) - paste(V,odd,sep=) df2 - repo.dat[,even) colnames(df2) - paste(V,even,sep=) --- On Mon, 23/6/08, Gundala Viswanath [EMAIL PROTECTED]

Re: [R] Columnwise Alternate Subsetting of a Data Frame

2008-06-22 Thread Charles C. Berry
See ?split help.search() is (or should be) your friend. HTH, Chuck On Mon, 23 Jun 2008, Gundala Viswanath wrote: Hi, Given this data frame: print(repo.dat) V1 V2 V3 V4 V5 (can be more) 1 1007_s_at DDR1