Re: [R] Help with code

2011-12-26 Thread Petr PIKAL
Hi Can you explain rules for propagating values? I do not see any pattern. Only when there is no Y in a line you want to fill all columns with either T1D_noc or Ctrl_noc based on t1d_ptype. I would start with narrowing the levels in last column as it seems to me there is no difference between

Re: [R] Help with code

2011-12-23 Thread Rui Barradas
Hello, There are so many people posting answers that I'm curious and decided to try one. I don't know if this is it but it doesn't give an error and it reformats your data according to the rules in your original code. # nr <- dim(c1)[1] nc <- dim(c1)[2] c2 <- NULL c2_row <- rep("", nc-1) for(i i

Re: [R] Help with code

2011-12-23 Thread Sarah Goslee
On Fri, Dec 23, 2011 at 9:25 AM, 1Rnwb wrote: > this is how the ouput from the code should be What code might that be? Readers of the R-help email list have no idea whatsoever what you're asking. Please include context, as requested in the posting guide. Sarah > structure(list(HTN = 1:10, HT

Re: [R] Help with code

2011-12-23 Thread 1Rnwb
this is how the ouput from the code should be structure(list(HTN = 1:10, HTN_FDR = structure(c(4L, 2L, 1L, 2L, 3L, 1L, 1L, 2L, 3L, 2L), .Label = c("Ctrl_noc", "T1D_noc", "T1D_oc", "T1d_w"), class = "factor"), Dyslipidemia = structure(c(3L, 2L, 1L, 2L, 4L, 1L, 1L, 2L, 4L, 2L), .Label = c("Ctrl_

Re: [R] Help with code

2011-12-22 Thread 1Rnwb
Thanks Bill, the output of dput was very similar to your example, I was not sure so did not put it on the post. however i uploaded the foo.txt file which contains the part of the data. sharad -- View this message in context: http://r.789695.n4.nabble.com/Help-with-code-tp4218989p4222947.html Sen

Re: [R] Help with code

2011-12-22 Thread 1Rnwb
here is the dump and the code once again, sorry for creating so much noise. c1<-structure(list(HTN = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("", "Y"), class = "factor"), HTN_FDR = structure(c(2L, 1L, 1L, 1L, 2L,

Re: [R] Help with code

2011-12-21 Thread Petr PIKAL
Hi > > I do not know how to use dput, i am attaching the txt file for the data dput(any.object) puts a structure of this object to console. You can copy it to your email and anybody can copy it back to R. Or you can transfer the structure to file see ?dput, ?dget > http://r.789695.n4.nabble.c

Re: [R] Help with code

2011-12-21 Thread William Dunlap
file c1.txt to your mail message. We will see if my mailer breaks up the lines in my example. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of 1Rnwb > Sent:

Re: [R] Help with code

2011-12-21 Thread 1Rnwb
I do not know how to use dput, i am attaching the txt file for the data http://r.789695.n4.nabble.com/file/n4222616/foo.txt foo.txt c1<-read.dlim('foo.txt') c2<-c1 any_comp<-NULL for( i in 1:dim(c1)[1]) { num_comp<-0 for (j in 1:dim(c1)[2]) if (c1[i,j]==2) num_comp=num_comp+1 #"Y"

Re: [R] Help with code

2011-12-20 Thread Petr PIKAL
Hi > > hello gurus, > > i have a data frame like this >HTN HTN_FDR Dyslipidemia CAD t1d_ptype[1:25] > 1Y YY T1D > 2 T1D > 3 Ctrl_FDR > 4

Re: [R] Help with code

2011-12-20 Thread Justin Haynes
help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Justin Haynes > > Sent: Tuesday, December 20, 2011 11:54 AM > > To: 1Rnwb > > Cc: r-help@r-project.org > > Subject: Re: [R] Help with code > > > > the short answer... which is a guess cau

Re: [R] Help with code

2011-12-20 Thread William Dunlap
ibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Justin Haynes > Sent: Tuesday, December 20, 2011 11:54 AM > To: 1Rnwb > Cc: r-help@r-project.org > Subject: Re: [R] Help with code > > the short answer.

Re: [R] Help with code

2011-12-20 Thread Justin Haynes
the short answer... which is a guess cause you didn't provide a reproducible example... is: your column (i think its called t1d_ptype[1:25]) is a factor and using factors is dangerous at best. you can check with ?str. see ?factor for how to convert back to strings and see if your code works.

[R] Help with code

2011-12-20 Thread 1Rnwb
hello gurus, i have a data frame like this HTN HTN_FDR Dyslipidemia CAD t1d_ptype[1:25] 1Y YY T1D 2 T1D 3 Ctrl_FDR 4 T1D 5Y

Re: [R] help with Code

2011-07-10 Thread Joshua Wiley
Hi, 1) Still not reproducible because we do not have "E.csv" 2) The help list is not for homework questions. Many (most?) professors and/or their TAs offer office hours where they are willing to provide help and guidance (unless, of course, the assignment is meant to encourage you to learn on you

Re: [R] help with Code

2011-07-10 Thread finguy
R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i386-pc-mingw32/i386 (32-bit) Thanks for responding Josh. I got all the codes from my professor. Here is what was required ##Load fPortfolio, PerformanceAnalytics, fOptions

Re: [R] help with Code

2011-07-10 Thread Joshua Wiley
Hi, Please provide a *reproducible* example (as the posting guide requests). It is also courteous to report your version of R and the package which contains the chart.Regression() function. We can look it up, but it saves time if you just say it. Josh On Sun, Jul 10, 2011 at 12:52 PM, finguy

[R] help with Code

2011-07-10 Thread finguy
chart.Regression(MCD,SPX, Rf = .03/12, excess.returns = TRUE, main = "Security Characteristic Line", fit = c("loess", "linear"), legend.loc = "topleft") Error in as.vector(data[, i]) : subscript out of bounds Why is this happening? Thanks -- View this message in context: http://r.789695.n4.nabb

Re: [R] help with code

2010-04-26 Thread Sarah Goslee
Hi Randy, > The SAS code for what I want to do is: > /* > >  if FTIStandKey=" NAH6253-003" then do; > >   CoverType=" XSOP--C "; > >   V_SpGrp="T"; > >   V_Origin="T"; > >  end; > I admit I didn't read all the sample code you added, but this is what I *think* you're trying to accomplish. myd

[R] help with code

2010-04-26 Thread Randy Cass
I am new to R and have tried for a good while to figure out how to code this in R. The dataset below: FTIStandKey State County FTITract CoverType Ver_CT V_Origin V_SpGrp NAH6005-001 Texas Jasper NAH6005 PPLB-2000-U PPLB-2000-U P P NAH6005-002 Texas Jasp