Re: [R] Create factor variable by groups

2011-07-05 Thread Dennis Murphy
Hi: There are several ways to do this; I'll offer one from the plyr package. See inline. On Mon, Jul 4, 2011 at 9:57 PM, Mateus Rabello mateus_rabe...@hotmail.com wrote: Hi, suppose that I have the following data.frame:      cnae4 cnpj 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 Y      

Re: [R] modification of cross-validations in rpart

2011-07-05 Thread Petr Savicky
On Mon, Jul 04, 2011 at 09:22:23AM -0400, Katerine Goyer wrote: Hello, I am using the rpart function (from the rpart package) to do a regression tree that would describe the behaviour of a fish species according to several environmental variables. For each fish (sampling unit), I have

Re: [R] I need help for creating a timevar

2011-07-05 Thread kbr
Hi Josh, It works perfectly! Thanks a lot for your quick and helpful answer! Karen -- View this message in context: http://r.789695.n4.nabble.com/I-need-help-for-creating-a-timevar-tp3643658p3645575.html Sent from the R help mailing list archive at Nabble.com.

[R] condlogic.ff

2011-07-05 Thread Stat Consult
Dear All How can I Recompile condlogic.ff in LogicReg package for fitting a conditional logistic model? Best Regards, Leila __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] placing multiple rows in a single row

2011-07-05 Thread Annemarie Verkerk
Dear David, thanks so much, I was able to get it to work for my data! I don't really understand yet how the function works, but it seems extremely useful. Thanks again! Annemarie David Winsemius wrote: On Jul 4, 2011, at 2:32 PM, Annemarie Verkerk wrote: Dear people from the R help list,

[R] Problems in converting data points to functional data

2011-07-05 Thread gabrielmartos
Hello! Im using my own bases representation for functional data. In order to make F-PCA now I need to declare to my matrix containing the curves (in rows) as a *functional object*. data2fd function doesn't work! I do this: - f.proyections = matrix containing in rows the curves representation (Im

Re: [R] How to build a matrix of number of appearance?

2011-07-05 Thread UriB
Thanks for your reply Note that I guess that there are many providerID and I get the error cannot allocate vector of size 2.1 Gb (I can use the same trick for most of the other fields) Is there a way to do the same only for providerID with relatively high frequency? -- View this message in

[R] How to translate string to variable inside a command in an easy way in R

2011-07-05 Thread UriB
I want to write a function that get 2 strings y and z and does the following R command. temp-qq1[qq1$z==y,] for example if it get y=AMI and z=PrimaryConditionGroup It should do the following temp-qq1[qq1$PrimaryConditionGroup==AMI,] I could do it by the following function that is ugly and I

[R] Executing a function several time, how to save the output

2011-07-05 Thread Trying To learn again
Hi all, I try to exceute a function myfun that should use as input input1.csv and input2.csv . Then I try to save the output dat33 on a csv file (on per each time I execute input1..input 2 and so on). So my problem is how to finally obtain several csv file with ggt1.csv, ggt2.csv. The program

[R] problem in reading a sequence file

2011-07-05 Thread albert coster
Dear all, I have a file with some sequence (seq.txt). I am writting following code and getting error! Can please help me? seqfile-read.table(file=seq.txt) Warning message: In read.table(file = seq.txt) : incomplete final line found by readTableHeader on 'seq.txt' Thanks in advance Albert

Re: [R] Tables and merge

2011-07-05 Thread Silvano
- Original Message - From: Silvano silv...@uel.br To: r-help@r-project.org Sent: Thursday, June 30, 2011 9:07 AM Subject: Tables and merge Hi, I have 21 files which is common variable CODE. Each file refers to a question. I would like to join the 21 files into one, to construct

Re: [R] Simulating inhomogeneous Poisson process without loop

2011-07-05 Thread Ben Bolker
Tristan Linke tristan.linke at gmail.com writes: Dear all I want to simulate a stochastic jump variance process where N is Bernoulli with intensity lambda0 + lambda1*Vt. lambda0 is constant and lambda1 can be interpreted as a regression coefficient on the current variance level Vt. J is

Re: [R] problem in reading a sequence file

2011-07-05 Thread Ben Bolker
albert coster albertcoster2010 at gmail.com writes: Dear all, I have a file with some sequence (seq.txt). I am writting following code and getting error! Can please help me? seqfile-read.table(file=seq.txt) Warning message: In read.table(file = seq.txt) : incomplete final line

Re: [R] problem in reading a sequence file

2011-07-05 Thread albert coster
seqfile V1 1 NNATTAAAGGGC I want only NNATTAAAGGGC . Thanks Albert On Tue, Jul 5, 2011 at 1:58 PM, Ben Bolker bbol...@gmail.com wrote: albert coster albertcoster2010 at gmail.com writes: Dear all, I have a file with some sequence (seq.txt). I

Re: [R] Multilevel Survival Analysis - Cox PH Model

2011-07-05 Thread Terry Therneau
Three comments: 1. If there is no right censoring (and it appears not), I would use lmer on the awakening times, glmer on the FullyOriented variable. That is, I agree with Burt. Another option is GEE models 2. If you want to use a Cox model, then you can a. Add + cluster(id) to the

Re: [R] Multilevel Survival Analysis - Cox PH Model

2011-07-05 Thread Terry Therneau
Patients are either fully oriented or not (1 or 2) after an hour. If they're not, then the data is right censored. It doesn't look like right censored data to me, unless the time variable were time to full orientation; you labeled it time to awake which appears to be something different.

Re: [R] problem in reading a sequence file

2011-07-05 Thread Philipp Pagel
On Tue, Jul 05, 2011 at 02:06:02PM +0200, albert coster wrote: seqfile V1 1 NNATTAAAGGGC I want only NNATTAAAGGGC . If I understand correctly, your file simply contains one string (sequence) per line. In that case you may want to use scan() instead for

[R] Prettier axis labels when using log (or exp!!) scales in Lattice (follow up)

2011-07-05 Thread ottorino
Hi all, my mail is a follow up of this thread http://tolstoy.newcastle.edu.au/R/e12/help/10/11/4172.html. I'm trying to alter the labels of an xyplot where the y variable is in the order of millions (cell counts) I've found plenty of examples on the R mailing list archives as well as in the book

Re: [R] modification of cross-validations in rpart

2011-07-05 Thread Terry Therneau
Is there a way to do this modification in rpart or is there any other function I could use that would consider interdependence in the response variable? This feature already exists: the xval option can be a vector of integers that defines the left out groups. First all the 1's are left

Re: [R] How to build a matrix of number of appearance?

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 5:45 AM, UriB wrote: Thanks for your reply Note that I guess that there are many providerID and I get the error cannot allocate vector of size 2.1 Gb What code? (I can use the same trick for most of the other fields) Is there a way to do the same only for providerID

Re: [R] placing multiple rows in a single row

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 3:00 AM, Annemarie Verkerk wrote: Dear David, thanks so much, I was able to get it to work for my data! I don't really understand yet how the function works, but it seems extremely useful. The melt operation creates a long data.frame, (which is what many plotting

[R] if else loop

2011-07-05 Thread gary engstrom
Dear R help I was hoping you might be able to show me how to write a loop function take would ccomplish this task. library(prob) { a - sample ( 1:20, 100, replace=T) b-sample(5:24,100,replace=T) } dd - data.frame(a,b) dd # code piece I am looking for if(subset(dd,c(1,23,ordered=F))is found))(

Re: [R] Repeating a function in R

2011-07-05 Thread Daniel Malter
Thanks, Uwe, for sending me this the second time. I send my responses through nabble. So #1 does not seem to be an option; #2 I sometimes forget. Regards, Daniel Uwe Ligges-3 wrote: On 02.07.2011 20:51, Daniel Malter wrote: You can just tell the function to create 1000 random numbers. See

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
Dear all, I have one problem and did not find any solution.Please I want your help. I have two data frames and I want to concatenate them.But the thing is- two data frames are like this- V1 V2 A C G T 10 135344109 0 0 1 0

Re: [R] For help in R coding

2011-07-05 Thread ONKELINX, Thierry
Dear Vikas, Have at look at ?merge() Best regards, Thierry -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Bansal, Vikas Verzonden: dinsdag 5 juli 2011 16:51 Aan: David Winsemius CC: r-help@r-project.org Onderwerp: Re: [R]

Re: [R] condlogic.ff

2011-07-05 Thread Uwe Ligges
On 05.07.2011 12:20, Stat Consult wrote: Dear All How can I Recompile condlogic.ff in LogicReg package for fitting a conditional logistic model? Although your mail address suggests you should know yourself, please read the manual R Installation and Administration that includes a

Re: [R] Repeating a function in R

2011-07-05 Thread Uwe Ligges
On 05.07.2011 16:47, Daniel Malter wrote: Thanks, Uwe, for sending me this the second time. Daniel, I do not track names, sorry for posting twice. I send my responses through nabble. Great, so you found the main problem already. So #1 does not seem to be an option; It is an option:

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
Yes sir.I have already looked at merge() but as I am new to R,I was not able to understand the argument that how should i create a code for the logic i gave in previous mail . Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London

Re: [R] problem in reading a sequence file

2011-07-05 Thread Berend Hasselman
albert coster wrote: Dear all, I have a file with some sequence (seq.txt). I am writting following code and getting error! Can please help me? seqfile-read.table(file=seq.txt) Warning message: In read.table(file = seq.txt) : incomplete final line found by readTableHeader on

Re: [R] if else loop

2011-07-05 Thread Sarah Goslee
Hi Gary, A solution in two pieces. First, you need to be able to match the rows of your data frame. There might be a more elegant way to do it, but I couldn't think of one that gave the option of ordering or not, so I wrote a function: isin - function(dd, tomatch, ordered=TRUE) { # find

Re: [R] problem in reading a sequence file

2011-07-05 Thread Philipp Pagel
On Tue, Jul 05, 2011 at 04:53:32PM +0200, albert coster wrote: I'm taking this back to the list so others can follow up. Yes, the file is consists of one string (sequence) per line. The files format is following: Sequence NNATTAAAGGGC OK - in that case (and as you want a

Re: [R] For help in R coding

2011-07-05 Thread Adrienne Wootten
If I understand correctly, you want to keep the rows from each table which have common values in the second column. In which case, merge will work for this, such as in this example. Say you have these data frames: frame1 x A C G 1 0 -1 2 2 -1 0 -1 3 0 0 -1 4 1 1 -1 5 0 1 0

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
Hi I sorted out a little bit- I am using this code- vi=(m1 - merge(blaa, daf, by.x = V2, by.y = V2)) (m2 - merge(daf, blaa, by.x = V2, by.y = V2)) results are also coming fine. but i dont know i got another code- stopifnot(as.character(m1[,1]) == as.character(m2[,1]), all.equal(m1[,

Re: [R] Tables and merge

2011-07-05 Thread David Winsemius
On Jul 6, 2011, at 7:36 AM, Silvano wrote: - Original Message - From: Silvano silv...@uel.br To: r-help@r-project.org Sent: Thursday, June 30, 2011 9:07 AM Subject: Tables and merge I have 21 files which is common variable CODE. Each file refers to a question. I would like to join

Re: [R] RWinEdt problem

2011-07-05 Thread Richard Valliant
I received this reply offline from William Dietrich and am posting it in case it might help someone else. His fix did get RWinEdt going, but, in my case, the tabs that should have the open file names are blank. This fix worked with WinEdt 5.5 but not v.6. In the end, I decided to switch to Tinn-R.

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
Yes.this is perfect.but can i use the and () operator to check if two column have same value.Like- merge(frame1,frame2,by=xG) according to your data given in previous mail. so the output should be- x G A.x C.x A.y C.y 4 -1 11 -10 8 -1 00 -1 -1

Re: [R] Executing a function several time, how to save the output

2011-07-05 Thread Trying To learn again
Hi, I find the solution¡¡¡ It was the 1:2 so if I put a loop for iand replace it works¡¡¡ So Many Thanks¡¡¡ Forget My doubt¡¡ 2011/7/5 Trying To learn again tryingtolearnag...@gmail.com Hi all, I try to exceute a function myfun that should use as input input1.csv and input2.csv .

[R] hash table access, vector access c

2011-07-05 Thread Sam Steingold
Hi, I am confused by the way the indexing works. I read a table from a csv file like this: ysmd - read.csv(ysmd.csv,header=TRUE); ysmd.table - hash(); for (i in 1:length(ysmd$X.stock)) ysmd.table[ysmd$X.stock[i]] - ysmd[i,]; the first column (X.stock) is a string (factor): ysmd$X.stock[[100]]

Re: [R] Fw: volcano plot.r

2011-07-05 Thread Brian Diggs
See inline below, On 7/4/2011 8:00 PM, Ungku Akashah wrote: Hello. My name is Akashah. i work at metabolic laboratory. From my study, i found that volcano plot can help a lot in my section. i already studied about the volcano plot and get the coding to run in R software, unfortunately, there

Re: [R] Rpad library

2011-07-05 Thread Bos, Roger
Please note that Rpad is not being updated and does not work (unmodified) with versions of R greater than 2.9. So if you are trying to use it and it is not working, that may explain your difficulty. I still use it because better alternatives, like RApache, don't work on Windows. -Original

Re: [R] loop in optim

2011-07-05 Thread Joshua Wiley
Do you want something like this? ## Your data afull - read.table(textConnection( R_j R_m -0.0625 0.002320654 0 -0.004642807 0.0 0.005936332 0.032258065 0.001060848 0 0.007114057 0.0156250.005581558 0 0.002974794

Re: [R] hash table access, vector access c

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 12:53 PM, Sam Steingold wrote: Hi, I am confused by the way the indexing works. Actually I suspect you may be confused by how factors work. See below. I read a table from a csv file like this: ysmd - read.csv(ysmd.csv,header=TRUE); # And note that by default all

[R] Output data frame using write.table

2011-07-05 Thread Bansal, Vikas
Dear all, I have a data frame whose name is m1. I want to write this data frame in text file as output.I am using this code- write.table(m1, file = kas.txt, append = FALSE,row.names=F,quote=F,sep=\t) When I am opening my kas.txt file,the column names are not coming exactly above the column.

[R] Matrix 3d plot

2011-07-05 Thread петрович
I have a problem with a 3d plot, suppose we have a matrix like this: v1v2 v3 v4 jan-2010 0.5 0.250.250.3 feb-2010 0.35 0.12 0.120.4 mar-20100.150.250.25 0.1 and i want to plot this matrix in 3d plot where x-axis is

Re: [R] Output data frame using write.table

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 1:17 PM, Bansal, Vikas wrote: Dear all, I have a data frame whose name is m1. I want to write this data frame in text file as output.I am using this code- write.table(m1, file = kas.txt, append = FALSE,row.names=F,quote=F,sep=\t) When I am opening my kas.txt

Re: [R] Matrix 3d plot

2011-07-05 Thread Duncan Murdoch
On 05/07/2011 1:36 PM, петрович wrote: I have a problem with a 3d plot, suppose we have a matrix like this: v1v2 v3 v4 jan-2010 0.5 0.250.250.3 feb-2010 0.35 0.12 0.120.4 mar-20100.150.250.25 0.1 and i want to plot

Re: [R] Matrix 3d plot

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 1:36 PM, петрович wrote: I have a problem with a 3d plot, suppose we have a matrix like this: v1v2 v3 v4 jan-2010 0.5 0.250.250.3 feb-2010 0.35 0.12 0.120.4 mar-20100.150.250.25 0.1 and i want to

Re: [R] hash table access, vector access c

2011-07-05 Thread Sam Steingold
* David Winsemius qjvafrz...@pbzpnfg.arg [2011-07-05 13:21:57 -0400]: On Jul 5, 2011, at 12:53 PM, Sam Steingold wrote: I am confused by the way the indexing works. Actually I suspect you may be confused by how factors work. See below. probably both :-( being a lisper, I thought about

[R] sample function with different proportions

2011-07-05 Thread Ana Kolar
Hi there, I guess this is an easy one, but still:  I would like to randomly sample 0s and 1s but in a way that I end up having for example 70% of 1s and the rest of 0s and not 50:50 as this function does: sample(c(0,1), 100, replace = TRUE) Any recommendations? Many thanks! Ana

Re: [R] sample function with different proportions

2011-07-05 Thread Joshua Wiley
Hi Ana, Look at the documentation for ?sample, specifically, the prob argument. In your case this should work: sample(c(0,1), 100, replace = TRUE, prob = c(.3, .7)) note that you may not have *exactly* 70% 1 and 30%, in any given sample. HTH, Josh On Tue, Jul 5, 2011 at 11:21 AM, Ana Kolar

Re: [R] problem in reading a sequence file

2011-07-05 Thread Ulrich Staudinger
Albert, the output you show contains a column header, v1, and a row index, 1. In order to access this information, you can for example use x[1,1]. read.table reads a table and thus expects rows and columns. kind regards, Ulrich -- comnect on xing or linkedin On 05.07.2011, at 14:07, albert

Re: [R] sample function with different proportions

2011-07-05 Thread Duncan Murdoch
On 05/07/2011 2:25 PM, Joshua Wiley wrote: Hi Ana, Look at the documentation for ?sample, specifically, the prob argument. In your case this should work: sample(c(0,1), 100, replace = TRUE, prob = c(.3, .7)) note that you may not have *exactly* 70% 1 and 30%, in any given sample. And if

Re: [R] sample function with different proportions

2011-07-05 Thread Ted Harding
Well, you can have exactly 70:30%, i.e. 70% 1s and 30% 0s, but in random order. For example: Popn - c(rep(1,70),rep(0,30)) Samp - sample(Pop) (see '?sample' for this usage -- the result of sample(x) is a random permutation of the elements of x). In probabilistic terms, this is a conditional

Re: [R] hash table access, vector access c

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 2:10 PM, Sam Steingold wrote: * David Winsemius qjvafrz...@pbzpnfg.arg [2011-07-05 13:21:57 -0400]: On Jul 5, 2011, at 12:53 PM, Sam Steingold wrote: I am confused by the way the indexing works. Actually I suspect you may be confused by how factors work. See below.

Re: [R] Wrong environment when evaluating and expression?

2011-07-05 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Joshua Wiley Sent: Monday, July 04, 2011 1:12 AM To: r-help@r-project.org Subject: [R] Wrong environment when evaluating and expression? Hi All, I have constructed two

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-05 Thread Greg Snow
You are suffering from the fact that the longest distance between 2 points is a shortcut. The df$column notation is a shortcut for df[[column]] that has some nice properties, but the shortcut gets in the way when you want to do something more structured. Try qq1[[z]]==y and avoid all that

Re: [R] hash table access, vector access c

2011-07-05 Thread Sam Steingold
* David Winsemius qjvafrz...@pbzpnfg.arg [2011-07-05 14:39:09 -0400]: So you are here demonstrating that you should be using [[ yes, thanks! now, how do I extend a frame with new columns based on a hash table? specifically, I have a frame: str(etr.rt) 'data.frame': 75986 obs. of 15

[R] Survival Analysis

2011-07-05 Thread avsha38
Hello, I have few questions about recurring events. I would greatly appreciate it if anyone can assist me. I have data that consist of approx 1,100 Consecutive patients released from hospital after first Myocardial infarction (MI). They were followed for 13 years. Recurrent MI and unstable

Re: [R] Output data frame using write.table

2011-07-05 Thread Steve Lianoglou
Hi, On Tue, Jul 5, 2011 at 1:17 PM, Bansal, Vikas vikas.ban...@kcl.ac.uk wrote: Dear all, I have a data frame whose name is m1. I want to write this data frame in text file as output.I am using this code- write.table(m1, file = kas.txt, append = FALSE,row.names=F,quote=F,sep=\t) When I am

[R] if else lop

2011-07-05 Thread gary engstrom
I am trying to use if...else loop and have included a code snippet which I might like to expand. Maybe you could steer me in the right direction. library(stats) library(prob) { a - sample ( 1:4,100, replace=T,prob=c(0.1,0.2,0.5,0.3))

Re: [R] if else lop

2011-07-05 Thread Sarah Goslee
Gary, Was the second half of my message this morning not clear enough? It wasn't clear from your original message that you were using isin() from the prob package, rather than using isin() as pseudocode, so I'd written a function to do that part. But the second half of my message went through

Re: [R] if else lop

2011-07-05 Thread peter dalgaard
On Jul 5, 2011, at 22:27 , gary engstrom wrote: I am trying to use if...else loop Argh! hurting of eyes and gnashing of teeth A loop goes _around_ and around. for, repeat, while. if ... else is a _branching_ construct. -- Peter Dalgaard Center for Statistics, Copenhagen Business School

Re: [R] if else lop

2011-07-05 Thread Joshua Wiley
On Tue, Jul 5, 2011 at 2:53 PM, peter dalgaard pda...@gmail.com wrote: On Jul 5, 2011, at 22:27 , gary engstrom wrote: I am trying to use if...else loop Argh! hurting of eyes and gnashing of teeth A loop goes _around_ and around. for, repeat, while. if ... else  is a _branching_

Re: [R] if else lop

2011-07-05 Thread Bert Gunter
Hi Peter: Beware that gnashing of teeth business. My Dad, a dentist, said that a couple of his patients who were musicians did this when they played and ground their teeth down so much he had to make them dentures! ;-) Cheers, Bert On Tue, Jul 5, 2011 at 2:53 PM, peter dalgaard

[R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread Trey Batey
Hello. This is a follow-up to a question I posted last week. With some previous suggestions from the R-help community, I have been able to plot survival (, hazard, and density) curves using published data for Siler hazard parameters from a number of ethnographic populations. Can the function

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread Bert Gunter
Yes, it can be done using basic plot commands. But if you really want to get fancy and plot grouped graphs, I strongly recommend you look into R's packages -- ggplot or trellis. Both have excellent documentation and companion books and were built for this sort of thing. The (considerable)

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread Steve Lianoglou
Quick note: On Tue, Jul 5, 2011 at 6:16 PM, Bert Gunter gunter.ber...@gene.com wrote: Yes, it can be done using basic plot commands. But if you really want to get fancy and plot grouped graphs, I strongly recommend you look into R's packages -- ggplot or trellis. Attempting to clear out any

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 6:08 PM, Trey Batey wrote: Hello. This is a follow-up to a question I posted last week. With some previous suggestions from the R-help community, I have been able to plot survival (, hazard, and density) curves using published data for Siler hazard parameters from a number

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 6:24 PM, David Winsemius wrote: On Jul 5, 2011, at 6:08 PM, Trey Batey wrote: Hello. This is a follow-up to a question I posted last week. With some previous suggestions from the R-help community, I have been able to plot survival (, hazard, and density) curves using

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread Bert Gunter
Yes. Trellis plots are in the lattice package. My bad. -- Bert On Tue, Jul 5, 2011 at 3:22 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: Quick note: On Tue, Jul 5, 2011 at 6:16 PM, Bert Gunter gunter.ber...@gene.com wrote: Yes, it can be done using basic plot commands. But if

Re: [R] How to build a matrix of number of appearance?

2011-07-05 Thread jim holtman
Provide some more information about the size of the data and the number of different ID combinations. I have found that in some cases like this using the 'sqldf' package helps since it can deal with large number of combinations. On Tue, Jul 5, 2011 at 5:45 AM, UriB uribl...@gmail.com wrote:

Re: [R] Output data frame using write.table

2011-07-05 Thread jim holtman
Use 'write.csv' and then use EXCEL as the way of formatting the output in the way that you like it. Otherwise you want use 'sprintf' to specify how you want the formatting done. On Tue, Jul 5, 2011 at 1:17 PM, Bansal, Vikas vikas.ban...@kcl.ac.uk wrote: Dear all, I have a data frame whose

[R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread Q
Hello, I'm trying to create a data frame where each row has a unique combination of factors. I start with a vector of species like so: 1 test - c(A,B,C,D) 1 test [1] A B C D To get all species combinations I have used expand.grid like this: 1 pairs - expand.grid(test,test) 1

Re: [R] sampling from the multivariate truncated normal

2011-07-05 Thread statfan
Well, for 0.828324 x[2] Inf the probablility is roughly 0 hence not easy to draw random numbers out there Uwe Ligges How is this probability roughly 0? -- View this message in context:

[R] function to compute pvalue for comparing two ROC curves

2011-07-05 Thread Brian Tsai
hi, I'm looking to compare two area under ROC values for different classifiers on the same data -- is there an r function to do this? Thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread jim holtman
Is this what you want: test - c(A,B,C,D) expand.grid(test,test) Var1 Var2 1 AA 2 BA 3 CA 4 DA 5 AB 6 BB 7 CB 8 DB 9 AC 10BC 11CC 12DC 13AD 14BD 15CD 16DD On Tue,

Re: [R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread jim holtman
Missed that you wanted to elim duplicated: z - expand.grid(test,test) # add 'unique' key z$key - apply(z, 1, function(x)paste(sort(x), collapse='')) str(z) 'data.frame': 16 obs. of 3 variables: $ Var1: Factor w/ 4 levels A,B,C,D: 1 2 3 4 1 2 3 4 1 2 ... $ Var2: Factor w/ 4 levels

Re: [R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread David Winsemius
On Jul 5, 2011, at 7:16 PM, Q wrote: Hello, I'm trying to create a data frame where each row has a unique combination of factors. I start with a vector of species like so: 1 test - c(A,B,C,D) 1 test [1] A B C D To get all species combinations I have used expand.grid like this: 1

Re: [R] plotting survival curves (multiple curves on single graph)

2011-07-05 Thread Dennis Murphy
Hi: Here's one way to put all the plots in one graph using ggplot2 and a couple of tricks using the plyr package. You could take the data frame I generate below and use it as input to lattice graphics if you prefer. For groupwise plots, either as an ensemble or as separate panels, these packages

Re: [R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread Jeff Newmiller
Reading ?expand.grid, there is a see also reference to combn which looks close to what you want. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead:

Re: [R] Tables and merge

2011-07-05 Thread Jeff Newmiller
Merge can only handle two tables at a time. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#.

[R] arma estimated return

2011-07-05 Thread Xiao Yang
Hi I am new to time series analysis using R. does anyone know what the estimated long term average of return means. I am doing an arma model fitting of exchange rates, and the question I have been asked is to estimate the long term average for the returns. Is this same as the intercept term?

Re: [R] arma estimated return

2011-07-05 Thread Rolf Turner
On 06/07/11 13:28, Xiao Yang wrote: Hi I am new to time series analysis using R. does anyone know what the estimated long term average of return means. I am doing an arma model fitting of exchange rates, and the question I have been asked is to estimate the long term average for the returns.

[R] Tables and merge

2011-07-05 Thread Walmes Zeviani
Silvano, I have some examples using merge() from my class notes in http://www.leg.ufpr.br/doku.php/disciplinas:ce223-2011-01. See aula11.R. For the moment, this minimal reproducible code can be useful id - 1:30 n - 20 a1 - data.frame(id=sample(id, n), v1=rnorm(n)) a2 - data.frame(id=sample(id,

[R] Retaining ID # with factor.scores procedure

2011-07-05 Thread Lutz, Jacob T.
I am using the factor.scores procedure in the ltm package to calculate theta values in a grm model. I need to retain individual subject IDs (which I have) and have not been able to do so. In addition the procedure re-orders the observations based on item response patterns. The only information

Re: [R] loop in optim

2011-07-05 Thread EdBo
Hi Josh I have run the code and the structure of the output is what I wanted. However, the code is giving an identical result for all runs. I have attached the code I ran below as well as the output. I have just changed number of runs to match with the size of the data.

Re: [R] Create a data frame of all possible unique combinations of factors

2011-07-05 Thread Q
Ah! I like the idea. Thanks! jholtman wrote: Missed that you wanted to elim duplicated: z - expand.grid(test,test) # add 'unique' key z$key - apply(z, 1, function(x)paste(sort(x), collapse='')) str(z) 'data.frame': 16 obs. of 3 variables: $ Var1: Factor w/ 4 levels A,B,C,D: 1 2

[R] how to best present concentrated data points/ ggplot2

2011-07-05 Thread Yang Lu
Hi all, I am trying to plot a weighted density plot for two different types and want to show the data points on the x axis. The code is as follows. The data points are very concentrated. Is there a better way to present it( should I set the alpha value or something else)? Thanks! YL

Re: [R] loop in optim

2011-07-05 Thread Joshua Wiley
On Tue, Jul 5, 2011 at 7:07 PM, EdBo n.bow...@gmail.com wrote: Hi Josh I have run the code and the structure of the output is what I wanted. However, the code is giving an identical result for all runs. Right because the object a stays the same for all runs. I have attached the code I ran

Re: [R] how to best present concentrated data points/ ggplot2

2011-07-05 Thread Ista Zahn
Hi Yang, Strategies for dealing with overplotting include transparency, size, and jittering. In your example you'll probably need all three. m + geom_point(aes(x = expo, y = ze, shape = type), size = 1, alpha = .2, position = position_jitter(width = 0, height = 5)) + geom_density() seems to

Re: [R] how to best present concentrated data points/ ggplot2

2011-07-05 Thread Joshua Wiley
Hi Yang, I would take a slightly different approach and use what Wilkinson calls stripe density plots. The idea is that if you are trying to show a univariate density on dimension 1 with many overlapping or extremely close observations, space on dimension 1 is precious, in two dimensions, space

[R] How to compare ratio from multiple groups?

2011-07-05 Thread Lao Meng
If I have 3 groups,and for each group,I get the ratio(e.g. incidence rate). Now I wanna compare 3 ratio pairwise,and get the corresponding p values,i.e: group1 vs group2 ,p value=? group1 vs group3 ,p value=? group2 vs group3 ,p value=? Which statistical test should be used? Thanks a lot for

Re: [R] loop in optim

2011-07-05 Thread EdBo
You are right Joshua. I changed the code because I failed to understand how you attached the full data set. How you made the data part of your code. I am new to R so I am used to one way of attaching data(the way I redone it). -Original Message- From: Joshua Wiley-2 [via R]

[R] Leverage values in VGLM

2011-07-05 Thread Nirmal Kanna
Hi, I just want to know how to get leverage values in VGLM(Adjacent category logit model, *acat()*) model [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the