[R] Faster matrix operation?

2010-06-01 Thread Remko Duursma
Dear R-helpers, I have a three-column matrix with lots of rows: xyzs - matrix(rnorm(3*10,0,1),ncol=3) # And I am multiplying it with some vector V, and summing the rows (columns after t()) in this way: V - c(2,3,4) system.time(vx - apply(t(xyzs) * V, 2 ,sum)) Ok, this does not take long

Re: [R] Faster matrix operation?

2010-06-01 Thread Bill.Venables
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 all.equal(vx, wx) [1] TRUE ? -Original

[R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
Dear group, Here is the kind of data.frame I obtain every day with my function : 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

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

[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

[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

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

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

2010-06-01 Thread e-letter
On 31/05/2010, Gabor Grothendieck ggrothendi...@gmail.com 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

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 ggrothendi...@gmail.com 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

Re: [R] Sweave amp; png

2010-06-01 Thread Gildas Mazo
Thank you Ben Bolker a écrit : Gildas Mazo gildas.mazo at 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)

[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.11 Jul/10 ),

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

Re: [R] Faster matrix operation?

2010-06-01 Thread baptiste auguie
On 1 June 2010 11:34, Peter Ehlers ehl...@ucalgary.ca 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,

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

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

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. When

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){

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(0), class

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

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.

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

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

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

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

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

[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 (chromosome,

[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(40.2,

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 commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand

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

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 -Original

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 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,

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

Re: [R] Plot multiple columns

2010-06-01 Thread Ben Bolker
Noah Silverman noah at 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

[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

[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)

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

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 regression,

[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

[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

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

[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

[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

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 j.j.que...@googlemail.com 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

[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:

[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

[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

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 ross.cull...@dur.ac.uk 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

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 t.hoebin...@gmail.com 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

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, 2010 at

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 SpeciesF Tree [[3]] [1]

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

[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

[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

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

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, Species,

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

[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 Joris Meys
Is this what you're looking for? seal_list - split(seal_dist,sel) out - lapply(seal_list,function(x){ indx - subset(x, x$DIST == 0) x$TO_ID - indx$ID[match(x$TO, indx$TO)] return(x) }) output - unsplit(out,sel) Cheers Joris On Tue, Jun 1, 2010 at 3:32 PM, RCulloch

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

2010-06-01 Thread Joris Meys
Sorry, forgot to add the sel. This is the first line, then just run the rest. sel - as.factor(paste(seal_dist[,10],-,seal_dist[,5],sep=)) cheers Joris On Tue, Jun 1, 2010 at 4:56 PM, Joris Meys jorism...@gmail.com wrote: Is this what you're looking for? seal_list - split(seal_dist,sel)

Re: [R] Help on aggregate method

2010-06-01 Thread Erik Iverson
It's easiest for us to help if you give us a reproducible example. We don't have your datasets (ap.dat), so we can't run your code below. It's easy to create sample data with the random number generators in R, or use ?dput to give us a sample of your actual data.frame. I would guess your

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
It is indeed ddply() from package plyr. -Original Message- From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sent: Tuesday, June 01, 2010 12:24 PM To: Peter Ehlers Cc: arnaud Gaboury; r-help@r-project.org Subject: Re: [R] data frame manipulation with zero rows On Tue, 1

[R] Question about the license of an R package

2010-06-01 Thread Mauricio Zambrano
Dear R-users, I'm developing a package that heavily depends on another package released under the GPL-2 license. In addition, some few functions depends on other packages released under the following licences (as described in the corresponding pages of http://cran.r-project.org/web/packages/):

[R] BreastCancer Dataset for Classification in kknn

2010-06-01 Thread Nitin
Dear All, I'm getting a error while trying to apply the BreastCancer dataset (package=mlbench) to kknn (package=kknn) that I don't understand as I'm new to R. The codes are as follow: rm = (list = ls()) library(mlbench) data(BreastCancer) library(kknn) BCancer = na.omit(BreastCancer) d =

Re: [R] Issue with assigning text to matrix

2010-06-01 Thread Peter Ehlers
Jessica, Two further comments: 1. When you read your data, your character vectors are stored as factors; is that what you want? 2. You may be better off using a list. -Peter Ehlers On 2010-06-01 7:47, Sarah Goslee wrote: On Tue, Jun 1, 2010 at 5:04 AM, Jessica Queree

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

2010-06-01 Thread RCulloch
Hi Joris, Thanks for your help! The data as requested: structure(list(FROM = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), TO = c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L,

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

2010-06-01 Thread RCulloch
Hi Ivan, Thanks again for your help! I'll just go through your questions... I'm still really confused about your question. -Sorry!!! 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

[R] How to make R automatic?

2010-06-01 Thread zhangted001
Hello, I have a question about how R can run automatically. Here is the story: A file called data.csv will be generated every couple of minutes in a folder (overwrite itself). What I want R to do is: 1) scan the folder to find the file. 2) if the file is a newly generated file, process the

[R] using the design matrix to correctly configure contrasts

2010-06-01 Thread Karl Brand
Esteemed R-forum subscribers, I'm having a tough time configuring contrasts for my 3-way ANOVA. In short: I don't know how to configure (all) my contrasts correctly in order to specify (all) my comparisons of interest. I succeeded getting my contrasts of interest set up for a simpler 2-way

Re: [R] Help on aggregate method

2010-06-01 Thread Joris Meys
Take a look at ?split (and unsplit) eg: Dur - rnorm(100) Attr1=rep(c(A,B),each=50) Attr2=rep(c(A,B),times=50) ap.dat -data.frame(Attr1,Attr2,Dur) split.fact - paste(ap.dat$Attr1,ap.dat$Attr2) ap.list -split(ap.dat,split.fact) ap.mean -lapply(ap.list,function(x){

Re: [R] How to make R automatic?

2010-06-01 Thread Charles C. Berry
?Sys.sleep On Tue, 1 Jun 2010, zhangted001 wrote: Hello, I have a question about how R can run automatically. Here is the story: A file called data.csv will be generated every couple of minutes in a folder (overwrite itself). What I want R to do is: 1) scan the folder to find the file.

Re: [R] How to make R automatic?

2010-06-01 Thread Peter Ehlers
On 2010-06-01 8:07, zhangted001 wrote: Hello, I have a question about how R can run automatically. Here is the story: A file called data.csv will be generated every couple of minutes in a folder (overwrite itself). What I want R to do is: 1) scan the folder to find the file. 2) if the file

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

2010-06-01 Thread Joris Meys
OK, then I was right. It's exactly what my code does. Enjoy. Cheers On Tue, Jun 1, 2010 at 4:25 PM, RCulloch ross.cull...@dur.ac.uk wrote: Hi Joris, Thanks for your help! The data as requested: structure(list(FROM = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,

Re: [R] How to make R automatic?

2010-06-01 Thread Nikhil Kaza
?difftime ?file.info file.info(filename)$mtime Sys.sleep(20) Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail.com On Jun 1, 2010, at 10:07 AM, zhangted001 wrote: Hello, I have a question about how R can run automatically. Here is

Re: [R] Help on aggregate method

2010-06-01 Thread Stella Pachidi
Dear Erik and R experts, Thank you for the fast response! I include an example with the ChickWeight dataset: ap.dat - ChickWeight matchMeanEx - function(ind,dataTable,aggrTable) { index - which((aggrTable[,1]==dataTable[[Diet]][ind]) (aggrTable[,2]==dataTable[[Chick]][ind]))

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

2010-06-01 Thread Ivan Calandra
Hi Ross, I think Joris answered your question, but to keep with your own code: To set up a list, you can use: DIST_LOOP - list() Or, if you know the length: DIST_LOOP - vector(mode=list, length=11) You would then fill up with (in your for loop): DIST_LOOP[[i]] - SEL_HR ##Actually, what you had

Re: [R] Question about the license of an R package

2010-06-01 Thread Duncan Murdoch
Mauricio Zambrano wrote: Dear R-users, I'm developing a package that heavily depends on another package released under the GPL-2 license. Are you including code from that package in yours, or just making use of it? The former requires that you follow all the GPL rules about your own.

Re: [R] R-help spam detection; please help the moderators

2010-06-01 Thread Joris Meys
Hi all, I also couldn't help but notice that some of my messages are bounced for following reason: The message headers matched a filter rule I included the header of one of the messages below, but neither of these messages is sent trough Nabble, nor does any mail address has digits in it. I

[R] as.date

2010-06-01 Thread arnaud Gaboury
Dear group, Here is my df (obtained with a read.csv2()): df - structure(list(DESCRIPTION = c(COTTON NO.2 Jul/10, COTTON NO.2 Jul/10, PALLADIUM Jun/10, PALLADIUM Jun/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10), CREATED.DATE = c(13/05/2010, 13/05/2010, 14/05/2010, 14/05/2010, 10/05/2010,

Re: [R] using the design matrix to correctly configure contrasts

2010-06-01 Thread RICHARD M. HEIBERGER
Please look at the maiz example, the last example in ?MMC in the HH package. Follow the example all the way to the end. It illustrates a problem and then the resolution of the problem. install.packages(HH) ## if you don't have it yet. library(HH) ?MMC Rich [[alternative HTML version

Re: [R] as.date

2010-06-01 Thread Erik Iverson
Where does the problem comes from?? Maybe from my sytem date ?? Simply from not reading the options carefully enough, from ?strptime, ‘%y’ Year without century (00-99). If you use this on input, which century you get is system-specific. So don't! Most often values

Re: [R] as.date

2010-06-01 Thread Joshua Wiley
Hello, The lowercase 'y' is year without century. This should work for you: as.Date(x=df$CREATED.DATE, format=%d/%m/%Y) HTH, Josh On Tue, Jun 1, 2010 at 8:57 AM, arnaud Gaboury arnaud.gabo...@gmail.com wrote: Dear group, Here is my df (obtained with a read.csv2()): df -

Re: [R] as.date

2010-06-01 Thread Joris Meys
Change this line to : pose$CREATED.DATE=as.Date(pose$CREATED.DATE,%d/%m/%Y) # mind the capital Y pose DESCRIPTION CREATED.DATE QUANITY CLOSING.PRICE 1 COTTON NO.2 Jul/10 2010-05-13 1 81.2000 2 COTTON NO.2 Jul/10 2010-05-13 1 81.2000 3 PALLADIUM Jun/10 2010-05-14

Re: [R] Issue with assigning text to matrix

2010-06-01 Thread Joris Meys
Hi Jessica, this tells me that your text is saved as a factor. Try : names - read.csv(file=Names.csv,stringsAsFactors=F) Cheers Joris On Tue, Jun 1, 2010 at 11:04 AM, Jessica Queree j.j.que...@googlemail.comwrote: My issue relates to adding text to a matrix and finding that the text is

Re: [R] as.date

2010-06-01 Thread arnaud Gaboury
TY for the tip. The lower case is in fact the culprit. -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Tuesday, June 01, 2010 6:05 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] as.date Where does the problem comes from?? Maybe from

Re: [R] Help on aggregate method

2010-06-01 Thread Erik Iverson
Stella Pachidi wrote: Dear Erik and R experts, Thank you for the fast response! I include an example with the ChickWeight dataset: ap.dat - ChickWeight matchMeanEx - function(ind,dataTable,aggrTable) { index - which((aggrTable[,1]==dataTable[[Diet]][ind])

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

2010-06-01 Thread Joris Meys
Type in Google Arima R Read the first hit, the third, the fifth, and any other that says tutorial Cheers Joris On Tue, Jun 1, 2010 at 4:14 PM, shakira M m.shak...@gmail.com wrote: I am trying to understand R arima function. Any pointers would be appreciated. Thank you, Shakira.

Re: [R] Help on aggregate method

2010-06-01 Thread Stella Pachidi
Dear Erik, Thank you very much. Indeed ave did the same job amazingly fast! I did not know the function before. Many thanks to all R experts who answer to this mailing list, it's amazing how much help you offer to the newbies :) Kind regards, Stella On Tue, Jun 1, 2010 at 6:11 PM, Erik Iverson

Re: [R] Help barplots

2010-06-01 Thread khush ........
Dear All, Thank you very much for your kind help and support I got it. Jeet On Tue, Jun 1, 2010 at 5:32 PM, Jim Lemon j...@bitwrit.com.au wrote: 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

Re: [R] discriminant analysis

2010-06-01 Thread Uwe Ligges
Which kind of discriminant analysis? If you mean LDA, use lda() in package MASS and read the correpsonding book Modern Applied Statistics with S by Venables and Ripley published by Springer. Uwe Ligges On 01.06.2010 09:24, suman dhara wrote: Sir, Can you suggest some function for

Re: [R] Ignoring initial rows in a text file import

2010-06-01 Thread Uwe Ligges
On 01.06.2010 02:19, David Winsemius wrote: On May 31, 2010, at 8:14 PM, jim holtman wrote: try this: input - readLines(yourfile.txt) # determine start start - grep(\tBegin Main\t, input)[1] # first line if many Puzzled. I thought backslashes in grepping patterns needed to be doubled? I

Re: [R] Plot multiple columns

2010-06-01 Thread Noah Silverman
Hi, I used the term run, as each iteration of the Gibbs sampler produces 22 variables (coefficients for Beta in a regression model) The example wont work On 6/1/10 5:54 AM, Ben Bolker wrote: Noah Silverman noah at smartmediacorp.com writes: I'm running a long MCMC chain that is

Re: [R] Set resolution of embedded plots in pdf() or CairoPDF()

2010-06-01 Thread Uwe Ligges
Both pdf() and CairoPDF() produce vector graphics, hence there is no things such as resolution required here. Uwe Ligges On 27.05.2010 11:09, Will Eagle wrote: Dear all, how can I set the resolution of embedded plots in PDF using pdf() or CairoPDF() to a value of e.g. 600 dpi to meet

Re: [R] library installation problem, invalid regular expression in help indices

2010-06-01 Thread Uwe Ligges
I guess something strange is loaded or changed in your personal startup scripts (i.e. through your Renviron or Rprofile settings. Uwe Ligges On 27.05.2010 15:34, Rainer Machne wrote: Hi, I have a strange package installation problem after update to R 2.11.0 on Fedora Core 12. A colleague

Re: [R] BreastCancer Dataset for Classification in kknn

2010-06-01 Thread Joris Meys
Hi Nitin, It can be solved by splitting your data a bit different. You need more training data than you have evaluation data, eg : i1 = 1:400 i2=401:d Then it works on my computer. No clue as to where the error originates from though. Cheers Joris On Tue, Jun 1, 2010 at 4:27 PM, Nitin

Re: [R] Fancy Page layout

2010-06-01 Thread Noah Silverman
Thanks Jim, That helps. Ben Bolker had a nice suggestion on how to get the lattice package to easily plot all 22 variables in one window. Ultimately, I'd like to generate a PDF that will print on a standard (8.5 x 11) page. A few things I'm still stuck are: 1) How to use the lattice

Re: [R] Question about the license of an R package

2010-06-01 Thread Mauricio Zambrano
2010/6/1 Duncan Murdoch murdoch.dun...@gmail.com: Mauricio Zambrano wrote: Dear R-users, I'm developing a package that heavily depends on another package released under the GPL-2 license. Are you including code from that package in yours, or just making use of it?  The former requires

Re: [R] R-help spam detection; please help the moderators

2010-06-01 Thread Ted Harding
Hi Joris, The matched a filter rule is the principal reason for holding messages for moderation. Please don't become anxious about the situation -- one of the reasons we have become concerned about the situation is that people whose messages get held up do tend to become worried about it. This is

[R] Problem using apply

2010-06-01 Thread Joachim de Lezardiere
Hello , I can not get apply function to do what I want when doing stuff on rows. Let's say I want to divide the rows of matrix by their mean, the below show you get the same result weather you use 1 or 2, i.e. same result for columns than for means..:( Thanks a lot for the help,

Re: [R] Problem using apply

2010-06-01 Thread Henrique Dallazuanna
The mean by col and by row are the same: colMeans(m) == rowMeans(m) So: m / rowMeans(m) # You don't need apply here m / colMeans(m) On Tue, Jun 1, 2010 at 2:26 PM, Joachim de Lezardiere joachim.lez...@gmail.com wrote: Hello , I can not get apply function to do what I want when doing

  1   2   >