[SVN] r5386 (R)

hadley wickham h.wickham at gmail.com
Sat Oct 7 11:49:48 UTC 2006


> > * attach and detach aren't very good programming style
>
> Really? Why is that? In all the books I've seen so far, it's one of
> the first things I was told when talking about data frames. Is there
> a more convenient way of dealing with data frames?

Basically because they pollute your global workspace - and creating
global variables is generally considered bad practice in almost any
programming language.  They also lead to problems like

df <- data.frame(a=1:3, b=4:6)
attach(df)
a
a <- 4:6
a
df$a

which many people don't expect.

Many functions will take a data frame as an argument, or you can use
with as a local attach.

> > * aggregate data isn't a very good name for turning a continuous into
> > a categorical variable
>
> I'm open to suggestions. Frankly the only reason I used it is that
> this is what SPSS calls it, if I recall correctly. Actually, now that
> I remember, I used it because that's also the word I found in
> Verzani's "Simple R" notes, which I am going through at the moment.

Aggregation involves some reduction of the data - this is more like
chopping or cutting (hence the name in R)

> > * the cumm snippet should probably be cum, so you can do cumsum and
> > cumprod as well (not that it saves you much typing)
>
> As you can see, I am new to R, didn't even know about cumsum and
> cumplot. Just adding functions as I encounter them. So keep your
> corrections/additions/comments coming.

I'd also suggest you think a bit about a framework for the type of
snippets you are going to expose.  I'm pretty happy with just typing
stuff in so I'm probably not the right person to ask about what should
be in there, but it seems like there should be some pattern so you can
guess what things are snippets and what are not.

(Also I noticed you have lines under polygonal lines - lines are not polygons!)

Hadley



More information about the textmate-dev mailing list