Re: [R] calculate row median of every three columns for a dataframe

2020-04-16 Thread David McPearson
Anna wrote: Hi all, I need to calculate a row median for every three columns of a dataframe. I made it work using the following script, but not happy with the script. Is there a simpler way for doing this? To which Jim L responded: Hi Anna, I can't think of a simple way, but this fun

Re: [R] read in csv.-data file with blanks and missing values

2016-01-18 Thread David McPearson
swizz-john wrote: > Hi people, > > my task is to analyse data that is formatted like this. > > date,bid,name,w1,w2,w3,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,debt2mkt,cds,equity > 28jul2009,1,"ABN Amro",56.5, > 29jul2009,1,"ABN Amro",56.5, > 30jul2009,1,"ABN Amro",

Re: [R] Bus stop sequence matching problem

2014-08-30 Thread David McPearson
Homework? The list has a no homework policy - but perhaps I'll be forgiven por posting hints. In general terms, this is how I appraoched the problem: * Loop through the rows of stop_onoff - for (idx in ...someething...) {... * For each row, find the first of "ref" in a suitably filtered subset of s

Re: [R] Unexpected behavior when giving a value to a new variable basedon the value of another variable

2014-08-29 Thread David McPearson
On Fri, 29 Aug 2014 06:33:01 -0700 Jeff Newmiller wrote > One clue is the help file for "$"... > > ?" $" > > In particular there see the discussion of character indices and the "exact" > argument. > <...snip...> > > On August 29, 2014 1:53:47 AM PDT, Angel Rodriguez > wrote: > > >Dear subsc

Re: [R] Line Graph greater than 2 variables on plot

2014-08-21 Thread David McPearson
You could also try matplot(data_object[, 1], data_object[, -1], ...) ?matplot Cheers. On Thu, 21 Aug 2014 09:55:29 +1000 "Duncan Mackay" wrote > Hi > > Try something like (as you have not given a reproducible example) > > library(lattice) > > xyplot(y1 + y2+ y3 ... ~ x, data = your data.fram

Re: [R] How to optimizing the code for calculating the launch time

2014-08-06 Thread David McPearson
On Tue, 5 Aug 2014 09:51:56 +0300 Lingyi Ma wrote > My dataset: > > Item_IdYear_Month > B65623262 201204 > B58279745 201204 > B33671102 201204 > B36630946 201204 > B63270151 201204 > B63270133 201204 > > > > I have written my code to calculate one more c

Re: [R] R function returning a list of variable(s) conditional on the value of an option?

2014-07-25 Thread David McPearson
I don't know about better or more elegant - but see inserts below... Cheers. On Fri, 25 Jul 2014 22:22:56 +1000 "Luke Hartigan" wrote > Dear all, > > I have an R function which returns a list of variables; however, within the > body of the function I would like to incorporate a branch based on

Re: [R] SQL vs R

2014-05-06 Thread David McPearson
On Tue, 6 May 2014 10:12:50 +0100 Dr Eberhard Lisse wrote > Jeff > > It's in MySQL, at the moment roughly 1.8 GB, if I pull it into a > dataframe it saves to 180MB. I work from the dataframe. > > But, it's not only a size issue it's also a speed issue and hence I > don't care what I am going to

Re: [R] changing x-axis in plot

2014-05-06 Thread David McPearson
On Tue, 6 May 2014 09:07:55 + Babak Bastan wrote > Hi experts > > I woul like to change my x-axis. Like this: 10,...,2,...,1 > > I am using this code: > > r<-c(1:10) > plot(r, axes=FALSE, frame.plot=TRUE,xlim=c(10,1)) > axis(1,at=10/seq(1:10)) > axis(2, at=axTicks(2), axTicks(2)) > > but

Re: [R] mean calculations from a dframe column

2014-04-14 Thread David McPearson
On Sun, 13 Apr 2014 05:01:40 -0700 (PDT) "andre.zacha...@gmail.com" wrote > Thank you very much!! > .. .. > *De :* arun kirshna [via R] > *Envoyé :* 13 avril 2014 11:23 > *À :* andre.zacha...@gmail.com > *Objet :* Re: mean calculations from a dframe column > > Hi André, > > Your codes wer

Re: [R] Mistakes in date conversion for future date/time (POSIXct)

2014-04-06 Thread David McPearson
I _do_ see this error - on R 3.0.3 / Win XP however, not on R 2.11.1 / Linux. (Same hardware, 2 x OS, 2 x R versions) Maybe it's peculiar to to 'doze... datetimesequenz <- seq.POSIXt(from=as.POSIXct("1960-01-01 00:00"), to=as.POSIXct("2100-01-01 00:00"), by="1 hour") levels(as.factor(strftime(dat

Re: [R] is it possible to get the coordinate of mtext()?

2014-03-18 Thread David McPearson
On Mon, 17 Mar 2014 15:18:50 -0700 Jinsong Zhao wrote > Hi there, > > I hope to rotate the Y label of axis(4) with -90 degree. I can typeset > the Y label using text() with srt = -90. However, I cannot get the > coordinate of the position that mtext() used. > <...cut...> locator(1) # Works

Re: [R] R Help

2014-03-11 Thread David McPearson
On Mon, 10 Mar 2014 18:26:38 + William Dunlap wrote > You probably want to read the Introduction to R that comes with R > (menu: Help>Manuals (in PDF)>Introduction to R). > > When I first started using R I found it easier to work through some of the contributed documentation. Have a look at