Re: [R] Referencing a vector of data labels in ggplot function

2011-07-11 Thread Ben Hunter
ct the line names to be matched up > to the lines though. > > Hadley > > On Fri, Jul 8, 2011 at 3:39 PM, Ben Hunter wrote: > > Hi, > > > > I really feel I've looked everywhere, although I know this can't be a > hard > > problem. I'd like to b

[R] Referencing a vector of data labels in ggplot function

2011-07-08 Thread Ben Hunter
Hi, I really feel I've looked everywhere, although I know this can't be a hard problem. I'd like to be able to call the graph below as a function, but I can't get the function to recognize variables beyond 'dframe'. I've read through many papers on writing functions in R, but I can't get this to w

Re: [R] nesting multiple for loops

2011-04-15 Thread Ben Hunter
Thanks Petr, Actually, I figured it out last night. Please read on only if you're sort of interested. You're absolutely right, I hastily changed my function to be more 'readable' without thinking that I was using a name that was already a function. What I wanted was a cross-tabulation of f1 and

[R] nesting multiple for loops

2011-04-14 Thread Ben Hunter
Hi everyone. I am quite frustrated that this doesn't work, as all the functions within work fine by themselves. I'd also like any pointers to how to avoid 'for' loops in my code. I understand it's less than desirable, but I'm still quite new and use them a lot. I have a few wide datasets (90 to 1

Re: [R] Putting a loop in a function

2011-04-02 Thread Ben Hunter
yped > out what you would like it to return based on a given input. I almost > think you just want grep(). > > grep("test", c("test", "not", "test2", "not"), value = TRUE) > [1] "test" "test2" > > using y

[R] Putting a loop in a function

2011-04-01 Thread Ben Hunter
I'm stuck here. The following code works great if I just use it on the command line in a 'for' loop. Once I try to define it as a function as seen below, I get bad results. I'm trying to return a vector of column indices based on a short string that is contained in a selection (length of about 70)

[R] Comparing parts of strings

2011-03-15 Thread Ben Hunter
Hi, I have a vector of strings (categories), each element of which can be uniquely found in each element of a much longer vector of about 30 or so differeint factors. I would like to define another factor variable (drawn from NewFactorListaccording to which string from "categories" is found in the

[R] LaTeX output with mlogit or multinom

2010-10-26 Thread Ben Hunter
Hi everyone, Why am I having such a tough time finding a way to put an mlogit summary table into latex? Everywhere I read says that using Sweave and latex is the most sophisticated, dynamic way to get output, but it appears very limited in this respect. I'm just starting out with Sweave and LaTeX

[R] Ordered logit with polr won't match SPSS output

2010-09-27 Thread Ben Hunter
I am learning R via a textbook that performs analysis with SPSS and SAS. In trying to reproduce the results for an ordinal logit model, I get very similar point estimates for my cut-off points, but the parameters for the covariate q60 do not match. The estimate for q51 also matches. Is this because