Re: [R] color palettes

2014-08-08 Thread Mark Knecht
?rainbow ?col2rgb rainbow(8) col2rgb(rainbow(8)[5]) col2rgb(rainbow(8)[5])[1] col2rgb(rainbow(8)[5])[2] col2rgb(rainbow(8)[5])[3] On Fri, Aug 8, 2014 at 6:26 AM, carol white wht_...@yahoo.com wrote: Hi, Is there any way to take one color of each color family from a color palettes like

Re: [R] Hello!

2011-02-27 Thread Mark Knecht
On Sat, Feb 26, 2011 at 10:11 PM, Bert Gunter gunter.ber...@gene.com wrote: Are you a fan of James Joyce? Is the Caps key on your keyboard broken? -- Bert Are your snide comments adding anything to the conversation? Do you allow for the possibility of an ESL speaker writing an email to this

Re: [R] Matrix Help

2011-02-20 Thread Mark Knecht
On Sun, Feb 20, 2011 at 2:56 PM, Dmitry Berman ravenb...@gmail.com wrote: On Sun, Feb 20, 2011 at 5:55 PM, Dmitry Berman ravenb...@gmail.com wrote: Listers, I have a simple matrix: -- m -c(1:7) m - cbind(m) m [1,] 1 [2,] 2 [3,] 3 [4,] 4 [5,] 5 [6,]

[R] How to properly use a generated test string as a name?

2011-02-09 Thread Mark Knecht
Title asks it all. Thanks in advance, Mark a = 1:5 b1 = 2:6 Z = data.frame(a,b1) Z Z$b1 count = 1 MyName = paste(b,count,sep=) MyName Z$MyName N = as.name(MyName) Z$N __ R-help@r-project.org mailing list

Re: [R] How to properly use a generated test string as a name?

2011-02-09 Thread Mark Knecht
On Wed, Feb 9, 2011 at 11:20 AM, Erik Iverson er...@ccbr.umn.edu wrote: Mark Knecht wrote: Title asks it all. Thanks in advance, Mark a = 1:5 b1 = 2:6 Z = data.frame(a,b1) Z Z$b1 count = 1 MyName = paste(b,count,sep=) MyName Z$MyName Z[[MyName]] Thank you Erik. I don't

[R] Keep date, strip time?

2011-02-08 Thread Mark Knecht
I have hundreds of CSV files coming in from another program that have a text field representing the date time combined together. I need to strip the time and keep the date. How could I do that? In the example below, on the first line I need to keep the 6/15/2009, turning it into a date that R

Re: [R] Keep date, strip time?

2011-02-08 Thread Mark Knecht
On Tue, Feb 8, 2011 at 11:30 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: Try as.Date() with a suitable format (it only knows about internationally standard formats), e.g. maybe you mean as.Date(6/10/2009 10:04:00 AM, format=%m/%d/%Y) [1] 2009-06-10 Thank you! - Mark

Re: [R] Keep date, strip time?

2011-02-08 Thread Mark Knecht
On Tue, Feb 8, 2011 at 11:29 AM, Phil Spector spec...@stat.berkeley.edu wrote: Mark -   Here's a few possibilites: dts = c('6/10/2009 10:04:00 AM','6/15/2009 9:47:00 AM','6/15/2009 9:47:00 AM') as.Date(sapply(strsplit(dts,' '),'[',1),'%m/%d/%Y') [1] 2009-06-10 2009-06-15 2009-06-15

[R] Iterate over a list of input files?

2011-02-08 Thread Mark Knecht
Hi, I've got the following code which seems to work fine for a single file if I specify the file name explicitly in the code. What I need to do is run it on all the files in the directory tested and augment the data frame I'm building to have more results columns.How can I do that? Here's

Re: [R] Summing over specific columns in a matrix

2011-01-07 Thread Mark Knecht
On Fri, Jan 7, 2011 at 8:42 AM, Henrique Dallazuanna www...@gmail.com wrote: Try this: rowSums(rowsum(t(m), rep(1:3, c(2, 2, 1)), na.rm = TRUE)) On Fri, Jan 7, 2011 at 2:29 PM, emj83 stp08...@shef.ac.uk wrote: Hi, I would like to sum some specific columns in my matrix- for example, my

Re: [R] about data export

2010-03-29 Thread Mark Knecht
?WriteXLS On Mon, Mar 29, 2010 at 6:29 AM, meghana kulkarni msk2...@gmail.com wrote: Hello all, This is Meghana. Well, I have some analysis output in 3 dimensional array form. for example: , , type1      A B C D      1 2 3  4      1 2 3 4  , , type2 etc. This array is very big.

Re: [R] R on Linux - a primer

2010-03-14 Thread Mark Knecht
On Sun, Mar 14, 2010 at 3:04 PM, Axel Urbiz axel.ur...@gmail.com wrote: Hi, I'm looking to move from Windows into a 64-bit Linux environment. Which is the best Linux Flavor to use within R? To install R on this environment, do I need to do any compiling? Thanks all! Axel. Do NOT pick

Re: [R] R on 64-Bit…

2010-02-21 Thread Mark Knecht
On Sun, Feb 21, 2010 at 2:43 PM, Axel Urbiz axel.ur...@gmail.com wrote: Dear R users, I know this issue came up in the list several times.  I’m currently running R on 32-bit on Windows and due to memory limitation problems would like to move to a 64-bit environment.  I’m exploring my options

Re: [R] Playing with rgl: a Youtube video

2009-12-22 Thread Mark Knecht
On Mon, Dec 21, 2009 at 4:42 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: I've just posted a demo made with the rgl package to Youtube, visible here:  http://www.youtube.com/watch?v=prdZWQD7L5c For future reference, here are the steps I used: 1.  Design a shape to be displayed, and then

[R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
What is the problem here? I did an install package from the Rgui menu. Windows Vista SNIP trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/mvtnorm_0.9-8.zip' Content type 'application/zip' length 236089 bytes (230 Kb) opened URL downloaded 230 Kb trying URL

Re: [R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
Is 2.10 out? I'll give it a try. Thanks, Mark On Thu, Oct 29, 2009 at 6:45 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/10/2009 9:43 AM, Mark Knecht wrote: On Thu, Oct 29, 2009 at 6:39 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/10/2009 9:11 AM, Mark Knecht wrote: What

Re: [R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
On Thu, Oct 29, 2009 at 6:39 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/10/2009 9:11 AM, Mark Knecht wrote: What is the problem here? I did an install package from the Rgui menu. Windows Vista normalizePath uses the Windows functions GetFullPathName and GetLongPathName to clean up

Re: [R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
Thanks Duncan. 2.10 seems to install things correctly. Cheers, Mark On Thu, Oct 29, 2009 at 6:52 AM, Mark Knecht markkne...@gmail.com wrote: Is 2.10 out? I'll give it a try. Thanks, Mark On Thu, Oct 29, 2009 at 6:45 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/10/2009 9:43 AM

Re: [R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
On Thu, Oct 29, 2009 at 9:45 AM, Jim Burke j.bu...@earthlink.net wrote: I think your are using R 2.10.0. No, I was using 2.9 and updating to 2.10 solved it for me. - Mark __ R-help@r-project.org mailing list

Re: [R] The system cannot find the file specified

2009-10-29 Thread Mark Knecht
On Thu, Oct 29, 2009 at 9:58 AM, hadley wickham h.wick...@gmail.com wrote: Do you have write permission in C:\Program Files\R\R-2.9.2\library?  It could be that the installer just tried to create the QRMlib subdir, and failed, and that's why it doesn't exist. One possible reason for failure

Re: [R] Best way to get stock quotes

2009-10-15 Thread Mark Knecht
Don't know about preferred but I believe the QuantMod package has a command for getting them from Yahoo finance. - Mark On Wed, Oct 14, 2009 at 11:24 PM, keifer jonathan.keith.hagan...@gmail.com wrote: What is preferred/better, get.hit.quote, priceIts, or other? -- View this message in

[R] Date/Time to date time

2009-09-20 Thread Mark Knecht
Hi, Can strptime (or some other function) help me turn the following column of a data.frame into two new columns, one as date and the other as time, preserving the AM/PM value? Thanks, Mark B ENTRY DATE 1 3/23/2009 6:30:00 AM 2 3/23/2009 6:30:00 AM 3 3/23/2009 6:39:00 AM 4

Re: [R] Date/Time to date time

2009-09-20 Thread Mark Knecht
chron.  as.Date(x) will convert an object to Date class if you want that instead. See R News 4/1 for more on dates and times. On Sun, Sep 20, 2009 at 4:11 PM, Mark Knecht markkne...@gmail.com wrote: Hi,    Can strptime (or some other function) help me turn the following column of a data.frame

Re: [R] Date/Time to date time

2009-09-20 Thread Mark Knecht
On Sun, Sep 20, 2009 at 1:55 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sun, Sep 20, 2009 at 4:52 PM, Mark Knecht markkne...@gmail.com wrote: Thanks Gabor,   I did try to use dput but it wasn't cooperating and wanted to send FAR too much data. dput(head(x, 10)) As I said, I

[R] lapply - value changes as parameters to function?

2009-09-18 Thread Mark Knecht
Hi, I'm trying to get better at things like lapply but it still stumps me. I have a function I've written, tested and debugged using individual calls to the function, ala: ResultList5 = DoAvgCalcs(IndexData, Lookback=5, SampleSize=TestSamples , Iterations=TestIterations ) ResultList8 =

Re: [R] lapply - value changes as parameters to function?

2009-09-18 Thread Mark Knecht
Computing Facility                                         Department of Statistics                                         UC Berkeley                                         spec...@stat.berkeley.edu On Fri, 18 Sep 2009, Mark Knecht wrote: Hi,  I'm trying to get better at things like lapply

Re: [R] lapply - value changes as parameters to function?

2009-09-18 Thread Mark Knecht
that Lookback is the first one.  The first parameter of the lapply is what is passed to the function as its first parameter.  Now just have ResultList - lapply(x, DoAvgCalcs, IndexData=IndexData, SampleSize=TestSamples, Iteration=TestIterations) On Fri, Sep 18, 2009 at 1:32 PM, Mark Knecht

Re: [R] lapply - value changes as parameters to function?

2009-09-18 Thread Mark Knecht
Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Knecht Sent: Friday, September 18, 2009 11:55 AM To: jim holtman Cc: r-help; Phil Spector Subject: Re: [R] lapply - value changes as parameters to function

[R] Any concept of 'by reference' or 'address of' in R?

2009-09-18 Thread Mark Knecht
Hi, Is there a way to pass the address of a data.frame through a set of functions in R? I've got some code which is slowing down I think because my data.frames are getting much larger - now approaching 1 million rows by 50-100 columns - and my functions - originally written for much smaller

Re: [R] Help with date specification

2009-09-17 Thread Mark Knecht
On Thu, Sep 17, 2009 at 9:11 AM, Subodh Acharya shoeb...@gmail.com wrote: Hi everyone,I have a data daily data (x) for 10 years starting from 04-01-1995 to 03-31-2005. I was able to get the yearly sum for the ten years using aggregate(x, years, sum). But this gave me the yearly sum for 1995

Re: [R] Manage an unknown and variable number of data frames

2009-09-13 Thread Mark Knecht
] ) ) CutTable On Sat, Sep 12, 2009 at 9:35 PM, David Winsemius dwinsem...@comcast.net wrote: On Sep 12, 2009, at 10:13 PM, Mark Knecht wrote: Hi,  In the code below I create a small data.frame (dat) and then cut it into different groups using

[R] Manage an unknown and variable number of data frames

2009-09-12 Thread Mark Knecht
Hi, In the code below I create a small data.frame (dat) and then cut it into different groups using CutList. The lists in CutList allow to me choose whatever columns I want from dat and allow me to cut it into any number of groups by changing the lists. It seems to work OK but when I'm done I

[R] Complex binning?

2009-09-10 Thread Mark Knecht
Hi, I need to do some binning which to date I've done just writing subset commands. I'm now wondering if there are any good packages that have some good pre-designed functions for multi-variable binning using say 4 or 5 variables, sometimes binning on 3 or more levels of each variable, and then

Re: [R] Complex binning?

2009-09-10 Thread Mark Knecht
reshape  (the package, not the base R function) There may well be others... Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Knecht Sent: Thursday, September 10, 2009 3:55 PM

[R] lag a data.frame column?

2009-09-09 Thread Mark Knecht
Sometimes it's the simple things... Why doesn't this lag X$x by 3 and place it in X$x1? (i.e. - Na's in the first 3 rows and then values showing up...) The help page does talk about time series. If lag doesn't work on data.frame columns then what would be the right function to use to lag by a

Re: [R] lag a data.frame column?

2009-09-09 Thread Mark Knecht
On Wed, Sep 9, 2009 at 11:09 AM, Achim Zeileis achim.zeil...@wu-wien.ac.at wrote: On Wed, 9 Sep 2009, Mark Knecht wrote: Sometimes it's the simple things... Why doesn't this lag X$x by 3 and place it in X$x1? It does. (i.e. - Na's in the first 3 rows and then values showing up

Re: [R] Confused - better empirical results with error in data

2009-09-07 Thread Mark Knecht
On Mon, Sep 7, 2009 at 12:33 PM, Noah Silvermann...@smartmediacorp.com wrote: SNIP So, this is really a philosophical question.  Do we:    1) Shrug and say, who cares, the SVM figured it out and likes that bad data item for some inexplicable reason    2) Tear into the math and try to figure

Re: [R] R-crash when loading workspace - Windows

2009-09-07 Thread Mark Knecht
On Mon, Sep 7, 2009 at 1:08 PM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 07/09/2009 10:34 AM, sebed1110-div...@yahoo.fr wrote: Dear all, One day when I tried to load an existing workspace (when opening R or by load()), R crashed without any error notification. The day before I had

Re: [R] Confused - better empirical results with error in data

2009-09-07 Thread Mark Knecht
On Mon, Sep 7, 2009 at 1:22 PM, Noah Silvermann...@smartmediacorp.com wrote: SNIP The data is listed in our CSV file from newest to oldest.  We are supposed to calculated a valued that is an average of some items.  We loop through some queries to our database and increment two variables -

Re: [R] Sort an array

2009-09-07 Thread Mark Knecht
?order Possibly something like A = A[order(A$Field1, A$Field2),] On Mon, Sep 7, 2009 at 3:22 AM, OLIVIER REGNIER-COUDERT (0509785)o.regnier-coud...@rgu.ac.uk wrote:  Hi, Would anybody know how to sort an array in order? I basically store the results from an analysis in an array and would

Re: [R] X11 plot window sizes

2009-09-02 Thread Mark Knecht
On Tue, Sep 1, 2009 at 9:06 AM, Mark Knechtmarkkne...@gmail.com wrote: Hi,   I'm not understanding how the width height parameters are supposed to work. When I execute the following 4 commands: X11() X11(width=20, height=20) X11(width=20, height=10) X11(width=40, height=40) I get the

Re: [R] X11 plot window sizes

2009-09-02 Thread Mark Knecht
On Wed, Sep 2, 2009 at 1:12 PM, Patrick Connollyp_conno...@slingshot.co.nz wrote: On Wed, 02-Sep-2009 at 07:02AM -0700, Mark Knecht wrote: | On Tue, Sep 1, 2009 at 9:06 AM, Mark Knechtmarkkne...@gmail.com wrote: | Hi, |   I'm not understanding how the width height parameters

[R] X11 plot window sizes

2009-09-01 Thread Mark Knecht
Hi, I'm not understanding how the width height parameters are supposed to work. When I execute the following 4 commands: X11() X11(width=20, height=20) X11(width=20, height=10) X11(width=40, height=40) I get the following *approximate* physical sizes on my screen: 6 x 6 8 x 8 12 x 6 8 x 8

Re: [R] Google style

2009-08-31 Thread Mark Knecht
On Mon, Aug 31, 2009 at 6:36 AM, Terry Therneauthern...@mayo.edu wrote: SNIP The authors borrowed so much else from C, the semicolon would have been good too. SNIP I know real R coders will chuckle but I've taken to using semicolons just because it looks better to my eyes and let's my brain

Re: [R] how to add data to some ts

2009-08-31 Thread Mark Knecht
On Mon, Aug 31, 2009 at 6:09 AM, Bunny, lautloscrew.combu...@lautloscrew.com wrote: Dear all, Finally, I made it, my RPostgreSQL works. After working through some tutorials, i was able to plot, get and replace several timeseries. Still I miss the opportunity (syntax) to add data. Most

Re: [R] Google style

2009-08-31 Thread Mark Knecht
On Mon, Aug 31, 2009 at 10:00 AM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 8/31/2009 11:50 AM, Mark Knecht wrote: On Mon, Aug 31, 2009 at 6:36 AM, Terry Therneauthern...@mayo.edu wrote: SNIP The authors borrowed so much else from C, the semicolon would have been good too. SNIP I

[R] new data.frame summed by date

2009-08-28 Thread Mark Knecht
Hi, I wonder if someone can suggest how to create a new data.frame Y from X where X$PL_Pos is summed by each unique X$MyDate. Y should end up with two (or more) columns Y$MyDate and Y$PL_Sum with its value being the cumsum of all the values in X for that date. - a 'daily cumsum'. Thanks, Mark

Re: [R] new data.frame summed by date

2009-08-28 Thread Mark Knecht
Jim, It looks exactly like what I wanted. Thanks! - Mark On Fri, Aug 28, 2009 at 10:03 AM, jim holtmanjholt...@gmail.com wrote: Is this what you want: aggregate(X$PL_Pos, list(X$MyDate), sum)      Group.1    x 1  2009-08-03  174 2  2009-08-04  -26 3  2009-08-05  614 4  2009-08-06  318

Re: [R] Differing rows in two data.frames?

2009-08-18 Thread Mark Knecht
On Mon, Aug 17, 2009 at 2:25 PM, Mark Knechtmarkkne...@gmail.com wrote: Hi,   What commands would I look at to compare row-by-row two data frames of the same size and print out any differences between the two? Thanks, Mark So I got an answer using the following code: XXX =

[R] Differing rows in two data.frames?

2009-08-18 Thread Mark Knecht
Hi, What commands would I look at to compare row-by-row two data frames of the same size and print out any differences between the two? Thanks, Mark __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Sort a dataframe on the column Date

2009-07-28 Thread Mark Knecht
On Mon, Jul 27, 2009 at 11:46 PM, Meenu Sahimeenus...@gmail.com wrote: Dear Users I have a dataframe called mydata4 of the following order with the first column as a date and the rest of the columns are numeric with rate. Column 1          Rate1 : Rate 20 (PxMid) 01/01/2003 07/01/2001

[R] skip plot/blank plot on purpose (multi-plot question)

2009-07-27 Thread Mark Knecht
Hi, Say that I've got a function that has the following code in it: X11(width=10, height=10) layout(rbind(c(1,1,1,2,2,2), c(3,4,5,6,7,8), c(9,10,11,12,13,14)), height=c(3,1,1)) layout.show(14) Sometimes when I call this function it will turn out by design that one or more of the data sets

Re: [R] skip plot/blank plot on purpose (multi-plot question)

2009-07-27 Thread Mark Knecht
On Mon, Jul 27, 2009 at 12:21 PM, Bert Guntergunter.ber...@gene.com wrote: Well, all of this can be done quite nicely with lattice graphics: ?xyplot (See, e.g. the skip argument) 1) Is there some generic way to call plot and have it plot, but it plots nothing so I don't see anything at all

Re: [R] More complicated multi-plot layouts?

2009-07-25 Thread Mark Knecht
Thanks guys! I appreciate the pointers. Cheers, Mark On Sat, Jul 25, 2009 at 5:57 PM, Gabor Grothendieckggrothendi...@gmail.com wrote: See ?layout opar - par(mar = c(2, 2, 2, 2)) m - matrix(c(1, 1, 1, 2, 2, 2,       1, 1, 1, 2, 2, 2,       3, 4, 5, 9, 10, 11,       6, 7, 8, 12, 13, 14),

[R] Include files?

2009-07-24 Thread Mark Knecht
Hi, I have 15 or 20 functions I've written to convert the sort of data I'm working with. They are currently in their own R file which I load by hand in Rgui before loading and running my main programs. Is there any way to have this file included in my R program like #include might in C?

Re: [R] Include files?

2009-07-24 Thread Mark Knecht
. See ?source and ?Startup Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Knecht Sent: Friday, July 24, 2009 11:25 AM To: r-help Subject: [R] Include files? Hi,   I have 15 or 20 functions I've written to convert

Re: [R] Include files?

2009-07-24 Thread Mark Knecht
On Fri, Jul 24, 2009 at 10:22 AM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 7/24/2009 12:25 PM, Mark Knecht wrote: Hi,   I have 15 or 20 functions I've written to convert the sort of data I'm working with. They are currently in their own R file which I load by hand in Rgui before loading

[R] howto create a list row-by-row as input to function call?

2009-07-23 Thread Mark Knecht
Hi, I'm having trouble within my function CalcPos to get it to call CalcHorz with values from each row. I *think* it's calling CalcHorz with the final values of the inputs and not the values from each row. How can I do this properly in R? The values aa,bb,cc,dd are inputs. CalcPos first

Re: [R] howto create a list row-by-row as input to function call?

2009-07-23 Thread Mark Knecht
On Thu, Jul 23, 2009 at 11:04 AM, Mark Knechtmarkkne...@gmail.com wrote: Hi,   I'm having trouble within my function CalcPos to get it to call CalcHorz with values from each row. I *think* it's calling CalcHorz with the final values of the inputs and not the values from each row. How can I do

[R] Multi-line comments?

2009-07-22 Thread Mark Knecht
Hi, I looked in the language definition and was surprised. Is there really no multi-line/block comment defined in R? I wanted to comment out 20 lines that I'm moving to a function but didn't want to delete them. Is there no defined way to get around using a # on each of the 20 lines?

Re: [R] Multi-line comments?

2009-07-22 Thread Mark Knecht
Thanks Gabor and EVERYONE else who answered so quickly. On Wed, Jul 22, 2009 at 7:50 AM, Gabor Grothendieckggrothendi...@gmail.com wrote: Try if (FALSE) { ... } On Wed, Jul 22, 2009 at 10:30 AM, Mark Knechtmarkkne...@gmail.com wrote: Hi,   I looked in the language definition and was

Re: [R] Merge vectors

2009-07-22 Thread Mark Knecht
Sort of like this? A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values B-c(10,5,5,10,8,11,2,7,3,11,10) #random numbers (sample) C = A[B] C [1] 130 43 43 130 98 230 5 91 7 230 130 On Wed, Jul 22, 2009 at 2:08 PM, Erik Iversoneiver...@nmdp.org wrote: A[B] -Original

[R] ifelse choices in a data.frame?

2009-07-19 Thread Mark Knecht
Hi, In my data.frame I wanted to essentially write If(Test) c*d else c+d but that doesn't work. I found I could do it mathematically, but it seems forced and won't scale well for nested logic. I have two examples below writing columns e f, but I don't think the code is self-documenting as

Re: [R] ifelse choices in a data.frame?

2009-07-19 Thread Mark Knecht
That's much better. thanks! I was sure I'd looked at that but then for some reason stuck with just if. Again, as a total a newb I appreciate the help. - Mark On Sun, Jul 19, 2009 at 2:26 PM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 19/07/2009 5:17 PM, Mark Knecht wrote: Hi,   In my

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Hi Gabor, Thanks for the pointer to Reduce. It looks quite interesting. I made an attempt to use it but I'm not clear how I would move the output of the Reduce execution on row 1 to become the Initial value on Row 2. In this output: MyDF Event Initial Offset Final 1 1 1-31

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Hi, No, it's not about cumsum specifically. It's about building up the list as the events go by. I managed to create this code but it does depend on a for loop. Notice how the Final value on each row becomes the Initial value on the next row. Basically I want to build a data.frame with 5-10

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Very interesting. Thanks. Very concise! interesting use of cumsum. I'll have to see if I can work that into my real code where I need to take a conditional cumsum. I think it will work. On my system the Final column doesn't seem quite right but that's OK. There's enough here for me to study and I

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Yes, I sort of guess at that one and found the answer. I don't quite really get what this 'with' command is really doing. It seems that I could have written something like out$Final - out$Initial+out$Offset. (Untested.) I guess it's primarily a way of not having to write the data.frame's name and

[R] apply/return and reuse

2009-07-17 Thread Mark Knecht
Hi, Is it possible to make something like the following code actually work? My goal in this example would be that I'd see results like 1 1 10100 2 10100 10200 3 10200 10300 4 10300 10400 In real usage the function would obviously do a lot more work, but the question I

Re: [R] Problems with computing an aggregated score

2009-07-15 Thread Mark Knecht
On Wed, Jul 15, 2009 at 3:37 AM, Hatschjohannes.h...@googlemail.com wrote: Hi all, I have a problem with computing a new variable as an aggregated score of other variables. Say, I have 10 variables for 1,000 observations (people). Every variable may have values between 0 and 8. What I

[R] subset range selections

2009-07-13 Thread Mark Knecht
How would I write the two selections each in a single subset command? 1) Two non-overlapping time ranges I want to collect together - before 10AM and after noon. Should be an OR function: X = subset(A, t1000) + subset(A, t1200) 2) One range between two defined times like after 10AM and before

Re: [R] subset range selections

2009-07-13 Thread Mark Knecht
Thanks Jim. How does one search the help system for info on simple logic like this? On Mon, Jul 13, 2009 at 6:59 AM, jim holtmanjholt...@gmail.com wrote: 1)   X - subset(A, (t 1000) | (t 1200)) 2)   X - subset(A, (t 1000) (t 1200)) On Mon, Jul 13, 2009 at 9:47 AM, Mark

Re: [R] Help me get this function to work...

2009-07-13 Thread Mark Knecht
On Mon, Jul 13, 2009 at 12:08 PM, David Winsemiusdwinsem...@comcast.net wrote: In R a function only returns the last evaluation, so you need to wrap up all of the local results into a list at the end of the function. SNIP David Winsemius, MD Heritage Laboratories West Hartford, CT How

[R] Reducing arrays for comparison with each other...

2009-07-13 Thread Mark Knecht
Hi, First up, thanks again for all the help I'm getting on this list. I'm making great headway in analyzing my experimental data on an experiment by experiment basis. No way I could have done this in the time I've done it without your help. This email is partially a question about R but is

[R] for (n in SystemResults$EnTime) return EnTime[n] until reaching (all)

2009-07-12 Thread Mark Knecht
Hi, Newbie alert on for loops... I have a bunch of data.frames built using rbind that have repeated values in the EnTime column. I want to read the value in the EnTime column and use it as an input to a function, but only down to the first occurrence of the string (all) where I want to

Re: [R] for (n in SystemResults$EnTime) return EnTime[n] until reaching (all)

2009-07-12 Thread Mark Knecht
On Sun, Jul 12, 2009 at 11:53 AM, Mark Knechtmarkkne...@gmail.com wrote: SNIP So this gets better in terms of error messages but still has problems for(n in SystemResults$EnTime) { if ( SystemResults$EnTime[n] == (all)) break else X = SystemResults$EnTime[n] print(X) } for(n

Re: [R] for (n in SystemResults$EnTime) return EnTime[n] until reaching (all)

2009-07-12 Thread Mark Knecht
On Sun, Jul 12, 2009 at 1:05 PM, David Winsemiusdwinsem...@comcast.net wrote: On Jul 12, 2009, at 3:35 PM, David Winsemius wrote: On Jul 12, 2009, at 2:53 PM, Mark Knecht wrote:  As a test I tried to print down to the string (all) and then break but this code and everything I've tried so

[R] Date conversions

2009-07-11 Thread Mark Knecht
Hi all, I'm having a little bit of trouble with some date conversions and am hoping someone can help me out. Thanks in advance. OK, I have two sources of data that provide date info in a csv file differently. I've attached a small zipped file with two text files that illustrate both. (Is it

Re: [R] Date conversions

2009-07-11 Thread Mark Knecht
On Sat, Jul 11, 2009 at 10:20 AM, Gabor Grothendieckggrothendi...@gmail.com wrote: No attachment appeared. I don't think the list allows zip files as attachments. Try plain text. On Sat, Jul 11, 2009 at 1:10 PM, Mark Knechtmarkkne...@gmail.com wrote: Hi all,   I'm having a little bit of

Re: [R] Date conversions

2009-07-11 Thread Mark Knecht
On Sat, Jul 11, 2009 at 12:05 PM, Gabor Grothendieckggrothendi...@gmail.com wrote: You want %Y, not %y. You might also want to look at the zoo package: library(zoo) z - read.zoo(Date1.txt, header = TRUE, sep = ,, format = %m/%d/%Y) or using chron: library(zoo) library(chron) z -

Re: [R] Date conversions

2009-07-11 Thread Mark Knecht
Thanks. Will do. Cheers, Mark On Sat, Jul 11, 2009 at 12:49 PM, Gabor Grothendieckggrothendi...@gmail.com wrote: Try: format(d, %a) or format(d, %A) or as.POSIXlt(d)$wday There is also day.of.week in chron. On Sat, Jul 11, 2009 at 3:42 PM, Mark Knecht markkne...@gmail.com wrote: On Sat

Re: [R] how can I download an english version of R ?

2009-07-10 Thread Mark Knecht
On Fri, Jul 10, 2009 at 2:43 AM, Casimir de Rhamcasimir.de.r...@polyaxon.com wrote: Dear colleagues, I am Professor of Operations Management at IUM, Intl. University of Monaco. The language at IUM is English and I want to test R. But I'm unable to get an English version (only useless

[R] ReShape/cast question - sum of value in table

2009-07-10 Thread Mark Knecht
Hi, I've tried to capture the basics of this problem I'm having. Been working on this for a couple of days and just cannot get past it. As a test of this list software I've attached is a small text file zipped up. I hope it gets through but if it doesn't I'll post the actual text which is only

Re: [R] ReShape/cast question - sum of value in table

2009-07-10 Thread Mark Knecht
On Fri, Jul 10, 2009 at 8:38 AM, Mark Knechtmarkkne...@gmail.com wrote: SNIP   What I need/want is that instead of displaying '1' or '2' - the number of events that fit these EnTime/ExTime values - I need to have the sum of the 'value' column from ReShape.Y.   Is this possible? I'm sure it's

[R] sort data.frame by specific date column

2009-07-10 Thread Mark Knecht
I have a data.frame that was built from a number of smaller data.frames with rbind. Each ssmaller data.frame bound together runs over the same date ranges. The format of the whole thing looks like this: Trade PosType EnDate EnTime ExDate ExTime PL_Pos 11 1 1040107915

Re: [R] sort data.frame by specific date column

2009-07-10 Thread Mark Knecht
1040115    921 1040115   1300 64 4   1 1040120   1134 1040120   1300    124 5   1 1040121    923 1040121   1300 84 6   1 1040205   1043 1040205   1300   -196 mydf.sort-mydf[order(mydf$EnDate),] mydf.sort Cheers milton brazil=toronto On Fri, Jul 10, 2009 at 10:30 PM, Mark

[R] 'scan' in a script?

2009-07-09 Thread Mark Knecht
When I use the scan function in the Rgui console it works as expected. However it seems that when I put the same command in a script file it doesn't wait for input. Is there an option to scan to make it wait for input when used in a script? Or is there possibly a different function that will do

Re: [R] 'scan' in a script?

2009-07-09 Thread Mark Knecht
Jim, In Rgui there is a feature to create a new script so I open that and get a blank editor. I put these commands in the script MyNames = scan(what=) MyNames Whether I ask Rgui to run the whole script as a script - not sourced - it runs the first command, doesn't wait for input and then

Re: [R] 'scan' in a script?

2009-07-09 Thread Mark Knecht
On Thu, Jul 9, 2009 at 6:05 PM, jim holtmanjholt...@gmail.com wrote: If you want the value printed in the script, then use the 'print' function: print(MyNames) There is an implicit 'print' when you type an object's name at the command line, but with you have it within a script, you have to

Re: [R] ReShape to create Time from Observations?

2009-07-08 Thread Mark Knecht
On Tue, Jul 7, 2009 at 4:22 PM, jim holtmanjholt...@gmail.com wrote: Does something like this work for you;  it uses the reshape package: X-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12, + Ob4=4:13, Ob5=3:12, Ob6=2:11) Y-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11,

Re: [R] Randomizing a dataframe

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 8:54 AM, Mark Namtb...@gmail.com wrote: Hi R-helpers, I have a dataframe (called data) with trees in rows (n=100) and insect species (n=10) in columns. My tree IDs are in a column called TREE and each species has a column labeled SPEC1, SPEC2, SPEC3, etc... I wish to

Re: [R] Extracting a column name in loop?

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 8:41 AM, mister_bluesmanmister_blues...@hotmail.com wrote: Hi, I am writing a script that will address columns using syntax like: data_set[,1] to extract the data from the first column of my data set, for example. This code will be placed in a loop (where the column

Re: [R] OK - I got the data - now what? :-)

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 10:51 AM, Michael A. Millermmill...@iupui.edu wrote: Mark wrote:     Currently my data is one experiment per row, but that's     wasting space as most experiments only take 20% of the row     and 80% of the row is filled with 0's. I might want to make     the array

[R] What is cast telling me?

2009-07-08 Thread Mark Knecht
Hi, What is cast telling me when it says the following? Aggregation requires fun.aggregate: length used as default What is 'length'? I've taken a small subset of data and wondered what EnTime vs ExTime might look like. cast is kind enough to give me a table but I don't understand the

Re: [R] What is cast telling me?

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 12:58 PM, rmail...@justemail.net wrote: That you have non-unique rows in your data (as identified by the identifying variables). Humm...OK - so I cast it with PL_Pos which has (in this data subset) a unique value for each experiment in this set. there are 25

Re: [R] Best way to export values from a function?

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 5:34 PM, Jason Rupertjasonkrup...@yahoo.com wrote: Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. I would like to know the best way to export several doubles from a function,

Re: [R] Best way to export values from a function?

2009-07-08 Thread Mark Knecht
On Wed, Jul 8, 2009 at 5:55 PM, Mark Knechtmarkkne...@gmail.com wrote: On Wed, Jul 8, 2009 at 5:34 PM, Jason Rupertjasonkrup...@yahoo.com wrote: Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. I would

[R] Thanks!

2009-07-07 Thread Mark Knecht
Hi all, I just wanted to send a general word of thanks to the list for making my first week using R successful (by my measures) and reasonably pleasurable. (Not a single literal RTFM!) ;-) I appreciate all the help I've received from folks. I have a long way to go but I'm starting to get

[R] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
Hi, I am apparently not understanding some nuance about either the use of subset or more likely my ability to test for a numerical match using '='. Which is it? Thanks in advance. I've read a data file, reshaped it and then created MyResults by keeping only lines where the value column is

Re: [R] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
On Tue, Jul 7, 2009 at 12:17 PM, Henrique Dallazuannawww...@gmail.com wrote: Try this: MyResults.GroupA - subset(MyResults, PosType == 1) SNIP Darn those small screen fonts. I never noticed that! Every example I'm looking at jsut looks like a single '=' until you pointed it out! Thanks to

  1   2   >