[R] Help on aggregate method

2010-06-01 Thread Stella Pachidi
Dear R experts, I would really appreciate if you had an idea on how to use more efficiently the aggregate method: More specifically, I would like to calculate the mean of certain values on a data frame,  grouped by various attributes, and then create a new column in the data frame that will have

Re: [R] storing output data from a loop that has varying row numbers

2010-06-01 Thread Ivan Calandra
Hi Ross, I'm still really confused about your question. Let me ask you some specific questions (maybe someone more experienced would understand at once, but I'm no expert; I hope I can still help you! In any case, I would like to understand for myself ;) ) - is "seal_dist" the name of your d

Re: [R] strsplit

2010-06-01 Thread Ista Zahn
Another option is to use the colsplit() function (in the reshape package): testdata <- data.frame(sp = c("GenusA_SpeciesC_Tree", "GenusA_SpeciesF_Tree", "GenusB_SpeciesA_Shrub"), stringsAsFactors=FALSE) library(reshape) testdata <- cbind(testdata, colsplit(testdata$sp, split="_", names=c("Genus",

Re: [R] storing output data from a loop that has varying row numbers

2010-06-01 Thread Joris Meys
could you just give us the output of dput() for the data you copied in the mail? eg dput(seal_dist[,1:100]) and an example of how you want your output. I guess I get what you want to do, but it's not what your code is doing. And it will be difficult to put that in a matrix, as you have different

[R] any doc to understand arima state space model?

2010-06-01 Thread shakira M
I am trying to understand R arima function. Any pointers would be appreciated. Thank you, Shakira. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] using R and for simulating a wireless network

2010-06-01 Thread amir
Hi, I want to simulate a simple wireless network in R. There is a source and destination and source sends some data packets to the destination and some routing table and so on. Does anyone have any idea and knowledge about this or are there any packages for this. The thing that I am going to do is

Re: [R] strsplit

2010-06-01 Thread Rafael Björk
This might not be the most elegant way of doing it, but it should probably work, given that data is always separated by a "_". string.1<-strsplit(c("GenusA_SpeciesC_Tree","GenusA_SpeciesF_Tree", "GenusB_SpeciesA_Shrub"),"_") matrix(unlist(string.1),ncol=3,byrow=TRUE) 2010/6/1 Joël Baumann > He

Re: [R] strsplit

2010-06-01 Thread Ivan Calandra
Hi, I don't know if it would help you since your goal is not really clear to me, but here are some thoughts: > x <- c("GenusA_SpeciesC_Tree", "GenusA_SpeciesF_Tree", "GenusB_SpeciesA_Shrub") > test <- strsplit(x, "_") > test [[1]] [1] "GenusA" "SpeciesC" "Tree" [[2]] [1] "GenusA" "Specie

Re: [R] strsplit

2010-06-01 Thread Sarah Goslee
How about this: testdata <- data.frame(sp = c("GenusA_SpeciesC_Tree", "GenusA_SpeciesF_Tree", "GenusB_SpeciesA_Shrub"), stringsAsFactors=FALSE) # for one unlist(strsplit(testdata[1,1], split="_")) # for all of them do.call(rbind, sapply(testdata[,1], strsplit, split="_")) Sarah On Tue, Jun 1,

Re: [R] save image to folder

2010-06-01 Thread Sarah Goslee
You might consider starting your search with ?png Sarah On Tue, Jun 1, 2010 at 5:34 AM, thoeb wrote: > > Hello, > > is there an equivalent to write.csv for saving images to a folder? E.g. if I > have a histogram or piechart I would need to write a command that saves the > resulting image as png

Re: [R] storing output data from a loop that has varying row numbers

2010-06-01 Thread Joris Meys
There's something very unlogic in your code. You have the whole time the same datafra On Tue, Jun 1, 2010 at 1:51 PM, RCulloch wrote: > > Hi All, > > I am trying to run a loop that will have varying numbers of rows with each > output. > > Previously I have had the same number of rows so I would

[R] [R-pkgs] Yet Another Package for Time Data

2010-06-01 Thread Charlotte Maia
Hi fellow R developers/users, I've recently revised a package called rtv, and now consider it reasonably stable. Description: A package for conveniently representing, manipulating and visualising time data. Here, time is regarded as a random variable, and objects are used to represent realisation

[R] strsplit

2010-06-01 Thread Joël Baumann
Hello! I have the following problem: I have a file in R that has in the first row three informations in one row that I would like to in three different rows. The first row looks like this: GenusA_SpeciesC_Tree GenusA_SpeciesF_Tree GenusB_SpeciesA_Shrub ... I tried with strsplit and and subs

[R] save image to folder

2010-06-01 Thread thoeb
Hello, is there an equivalent to write.csv for saving images to a folder? E.g. if I have a histogram or piechart I would need to write a command that saves the resulting image as png or jpg into a certain folder (working directory). Thanks -- View this message in context: http://r.789695.n4.na

Re: [R] Issue with assigning text to matrix

2010-06-01 Thread Sarah Goslee
On Tue, Jun 1, 2010 at 5:04 AM, Jessica Queree wrote: > My issue relates to adding text to a matrix and finding that the text is > converted to a number. > A matrix can only hold one type of data. Since you started with character, that's what you get. A dataframe can hold different types of data

[R] loop

2010-06-01 Thread mhalsham
Can any one help it will be very kind, loop statements I have this table and some more records, I want to reshape it V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 TP53 Dis1 Dis2 Dis3 Dis4 Dis5 Dis6 DCI New1 New2 New3 New4 FDI Hi2 H3 H4 GHD I1 I3 I4 I5 I6 I7 I8 I want my new table or matrix to be some thing lik

[R] discriminant analysis

2010-06-01 Thread suman dhara
Sir, Can you suggest some function for discriminant analysis for Binary response having continuous as well as categorical regressors. Thanks, Suman Dhara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.

Re: [R] storing output data from a loop that has varying row numbers

2010-06-01 Thread RCulloch
Hi Ivan, Thanks for your help, your initial suggestion did not work, but that is no doubt down to my lack of making sense! Here is a short example of my dataset. Basically the loop is set up to match the ID with the TO column based on DIST = 0. So A1 = 2, A1.1 =1, A2 = 4, A2.1 = 3. That is fin

[R] Issue with assigning text to matrix

2010-06-01 Thread Jessica Queree
My issue relates to adding text to a matrix and finding that the text is converted to a number. This is the section of code I'm having trouble with: # First, I load in a list of names from a .csv file to 'names' names <- read.csv(file("Names.csv")) # Then I define a matrix which will be p

[R] R-help "spam" detection; please help the moderators

2010-06-01 Thread Martin Maechler
Dear readers of R-help as most of you will *not* be aware, R-help has continued to work the way it does, only thanks to a dozen of volunteers, see https://stat.ethz.ch/mailman/listinfo/r-help . The volunteers manually moderate e-mails that "look like spam" (and sometimes are and sometimes are not

Re: [R] What does LOESS stand for?

2010-06-01 Thread JLucke
The closest "explanation" of the term "loess" I can find is in "Local regression models" by Cleveland, W. S.; Grosse, E. & Shyu, W. M. (Chapter 8 of Statistical models in S (1992) by Chambers, J. M. & Hastie, T. J.) ... local regression models is called "loess," which is short for "local regr

Re: [R] storing output data from a loop that has varying row numbers

2010-06-01 Thread Ivan Calandra
Hi, I might be a bit tired so that I don't understand everything but I'm a bit confused. How would you like your DIST_LOOP matrix to look like? What do you intend to use xdfrow1...xdfrow7? As I said, I might not be at the best of my shape! A sample dataset would really help to see what you ha

[R] storing output data from a loop that has varying row numbers

2010-06-01 Thread RCulloch
Hi All, I am trying to run a loop that will have varying numbers of rows with each output. Previously I have had the same number of rows so I would use (and I appreciate that this will no doubt achieve some gasps as being thoroughly inefficient!): xdfrow<-(0) xdfrow1<-(1:32) xdfrow2<-(33:64) x

[R] Mid-P value for a chi-squared test

2010-06-01 Thread Wilson, Andrew
Can anyone tell me how to calculate a mid-p value for a chi-squared test in R? Many thanks, Andrew Wilson __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/postin

Re: [R] Plot multiple columns

2010-06-01 Thread Ben Bolker
Noah Silverman smartmediacorp.com> writes: > > I'm running a long MCMC chain that is generating samples for 22 variables. > > I have each run of the chain as a row in a matrix. > So: Chain[,1] is the column with all the samples for variable one. > Chain[,2] is the column with all the samples

Re: [R] R on the iPhone/iPad? Not so much....a GPL violation

2010-06-01 Thread Marc Schwartz
Hi all, Thanks to an offlist e-mail from Thomas (Lumley), I have spent the past few days getting a bit more edumacated on additional restrictions on the opportunity for R to appear on the iPhone/iPad. These in fact go well beyond the GPL issue that I raised in my initial post, which in and of i

Re: [R] Help barplots

2010-06-01 Thread Peter Ehlers
On 2010-06-01 5:01, khush wrote: Dear All, I am newbie to R, and I wanted to plot a barplots with R and in such a way that It will also show me position which I can plot on the bar line. Here is my code that I am using to plot, chromosome<- c(40.2, 35.6, 36.1, 29.6, 31, 29.6, 31, 29.

Re: [R] Help barplots

2010-06-01 Thread Jim Lemon
On 06/01/2010 09:01 PM, khush wrote: Dear All, I am newbie to R, and I wanted to plot a barplots with R and in such a way that It will also show me position which I can plot on the bar line. Here is my code that I am using to plot, chromosome<- c(40.2, 35.6, 36.1, 29.6, 31, 29.6, 31,

Re: [R] Help barplots

2010-06-01 Thread Martyn Byng
Hi, If you want to draw lines on your barchart then aa = barplot(chromosome, col="purple", xlab="Oryza sativa Chromosomes", border = NA, space = 5, ylim = c(0,45)) returns the midpoints of each bar in the vector aa and then you can use the lines() function to do the drawing. Martyn -Origin

Re: [R] Fancy Page layout

2010-06-01 Thread Jim Lemon
On 06/01/2010 04:16 AM, Noah Silverman wrote: Hi, Working on a report that is going to have a large number of graphs and summaries. We have 80 "groups" with 20 variables each. Ideally, I'd like to produce ONE page for each group. It would have two columns of 10 graphs and then the 5 number su

Re: [R] two questions about PLOT

2010-06-01 Thread Jim Lemon
On 06/01/2010 12:44 AM, Jie TANG wrote: here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the command"axis(2)",But I failed. 2) how to add the axis information correctly.Since I have use the cmommand "axis(1,at=1:6,l

[R] Odp: Help barplots

2010-06-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2010 13:01:38: > Dear All, > > I am newbie to R, and I wanted to plot a barplots with R and in such a way > that It will also show me position which I can plot on the bar line. > > Here is my code that I am using to plot, > > > chromosome <- c(

[R] Help barplots

2010-06-01 Thread khush ........
Dear All, I am newbie to R, and I wanted to plot a barplots with R and in such a way that It will also show me position which I can plot on the bar line. Here is my code that I am using to plot, > chromosome <- c(40.2, 35.6, 36.1, 29.6, 31, 29.6, 31, 29.4, 28.2, 23, 23, 28.2) >barplot (chromosom

Re: [R] n-dimensional vector plot

2010-06-01 Thread David Winsemius
On Jun 1, 2010, at 12:51 AM, suman dhara wrote: Sir, I have n p-dimensional regressor vectors corresponding to n responses. I want to plot n regressor vectors in R. Is it possible to plot them in R? If yes, please send me the code. ?matplot Thanks, Suman Dhara David Winsemius, MD We

Re: [R] Printing page nmbers in multi-page pdf

2010-06-01 Thread David Winsemius
On May 31, 2010, at 11:40 PM, Nevil Amos wrote: Is it possible to print page numbers in pdf() with multiple pages? ?mtext thanks Nevil Amos __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] MacOS X binary for lme4 not available on CRAN

2010-06-01 Thread Prof Brian Ripley
First, this is not the list to discuss MacOS X binaries: that is R-sig-mac. Second, only one person really knows about the situation with package binaries, the person who produces them (equally true for Windows and for Mac OS X). And that person does not read R-help, having asked for such is

Re: [R] New behavior of 'write.csv' append argument?

2010-06-01 Thread Peter Ehlers
On 2010-05-31 18:33, Steven Worthington wrote: Dear R users, I have recently begun to reuse some functions I made several months ago. The scripts write to a .csv file using the 'write.csv' function with the append option set to TRUE. This used to work fine, albeit with the warning "appending co

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread Prof Brian Ripley
On Tue, 1 Jun 2010, Peter Ehlers wrote: On 2010-06-01 1:53, arnaud Gaboury wrote: Brian, If I do understand correctly, I must use in my function something else than ddply() if I want to avoid any error each time my df has zero rows? Am I correct? You could define a function to handle the ze

Re: [R] Plot multiple columns

2010-06-01 Thread baptiste auguie
Hi, You could use melt from the reshape package to create a long format data.frame. This is more easy to plot with lattice or ggplot2, and you can then use facetting to arrange several plots on the same page. The dummy example below produces 10 pages of output with 10 graphs per page. library(ggp

Re: [R] New behavior of 'write.csv' append argument?

2010-06-01 Thread Ivan Calandra
Is there a reason why append=TRUE should not be used? I actually use it a lot; that way I have less csv files created. I can output everything to a single file. Since some statistical tests returns lists with different number of elements, it is not always possible to export the output all at o

Re: [R] data frame manipulation ddply

2010-06-01 Thread arnaud Gaboury
Patrick, When apply to this following df : futures <- structure(list(DESCRIPTION = character(0), CREATED.DATE = structure(numeric(0), class = "Date"), QUANTITY = numeric(0), SETTLEMENT = character(0)), .Names = c("DESCRIPTION", "CREATED.DATE", "QUANTITY", "SETTLEMENT"), row.names = integer(

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread Peter Ehlers
On 2010-06-01 1:53, arnaud Gaboury wrote: Brian, If I do understand correctly, I must use in my function something else than ddply() if I want to avoid any error each time my df has zero rows? Am I correct? You could define a function to handle the zero-rows case: f <- function(x){ if(nrow(

Re: [R] two questions about PLOT

2010-06-01 Thread Ivan Calandra
It may not be the nicest solution, but my suggestion should work. Have you tried plot(type="n",...), plotting the axes with axis(), and plotting the data with lines()? Ivan Le 6/1/2010 10:10, Jie TANG a écrit : > thanks for your reply. > I have tried to use rseek.org.But still some problems. >

Re: [R] New behavior of 'write.csv' append argument?

2010-06-01 Thread jim holtman
As noted in the help file under CSV files: These wrappers are deliberately inflexible: they are designed to ensure that the correct conventions are used to write a valid file. Attempts to change append, col.names, sep, dec or qmethod are ignored, with a warning. On Mon, May 31, 2010 at 8:33 PM,

Re: [R] Plot multiple columns

2010-06-01 Thread Ivan Calandra
Hi, Try with: par(mfrow=c(11,2)) It should work better! Remember that mfrow is an argument of the function par(), not a function itself. One other tip: think about using pdf, ps, png, or SVG devices, I find it easier and nicer. HTH, Ivan Le 6/1/2010 10:02, Noah Silverman a écrit : I'm ru

Re: [R] Faster matrix operation?

2010-06-01 Thread baptiste auguie
On 1 June 2010 11:34, Peter Ehlers wrote: > Or, for a very slight further reduction in time in > the case of larger matrices/vectors: > >  as.vector(tcrossprod(V, xyzs)) > > I mention this merely to remind new users of the > excellent speed of [t]crossprod(). > >  -Peter Ehlers Thanks, I've been

Re: [R] Faster matrix operation?

2010-06-01 Thread Peter Ehlers
On 2010-06-01 0:16, bill.venab...@csiro.au wrote: xyzs<- matrix(rnorm(3*10,0,1),ncol=3) V<- c(2,3,4) system.time(vx<- apply(t(xyzs) * V, 2 ,sum)) user system elapsed 1.060.021.08 system.time(wx<- as.vector(xyzs %*% V)) user system elapsed 0 0 0 a

[R] data frame manipulation ddply

2010-06-01 Thread arnaud Gaboury
Dear group, Here is my data frame: futures <- structure(list(DESCRIPTION = c("CORN Jul/10", "CORN Jul/10", "CORN Jul/10", "CORN Jul/10", "CORN Jul/10", "LIVE CATTLE Aug/10", "LIVE CATTLE Aug/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO

Re: [R] Sweave & png

2010-06-01 Thread Gildas Mazo
Thank you Ben Bolker a écrit : > Gildas Mazo curie.fr> writes: > > >> Is there a simple way to save my figures in png instead of pdf with >> Sweave ?? >> > > > See > > http://sites.google.com/site/thibautjombart/r-packages > > (scroll to the bottom) > > ___

Re: [R] accessing a data frame with row names

2010-06-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2010 10:20:35: > On 31/05/2010, Gabor Grothendieck wrote: > > Use read.csv or read.table(..., sep = ","). Also note that if you > > delete the first comma of the header (as in the second example below) > > you won't have to specify row.names sinc

Re: [R] accessing a data frame with row names

2010-06-01 Thread e-letter
On 31/05/2010, Gabor Grothendieck wrote: > Use read.csv or read.table(..., sep = ","). Also note that if you > delete the first comma of the header (as in the second example below) > you won't have to specify row.names since it can figure it out from > the fact that there is one fewer column name

Re: [R] two questions about PLOT

2010-06-01 Thread Jie TANG
thanks for your reply. I have tried to use rseek.org.But still some problems. When I add "axis(4)" and axis(1,at=1:6,labels=gradeinfo$gradenam),the old tick or labels still are there as shown in the figure,how could I delete them( the old tick information in x-axis and left y axis ) My script is s

[R] Plot multiple columns

2010-06-01 Thread Noah Silverman
I'm running a long MCMC chain that is generating samples for 22 variables. I have each run of the chain as a row in a matrix. So: Chain[,1] is the column with all the samples for variable one. Chain[,2] is the column with all the samples for variable 2, etc. I'd like to fit all 22 on a single

[R] MacOS X binary for lme4 not available on CRAN

2010-06-01 Thread Armin Goralczyk
Dear group, I have noticed that the MacOS X binary for lme4 is not available on CRAN at the moment. I am aware that it may be possible to install from source but I am not very familiar with that procedure and would rather avoid it. But I need the package for a statistics course next week. So can a

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
Brian, If I do understand correctly, I must use in my function something else than ddply() if I want to avoid any error each time my df has zero rows? Am I correct? TY > -Original Message- > From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] > Sent: Tuesday, June 01, 2010 9:47 AM

<    1   2