[R] New behavior of 'write.csv' append argument?

2010-05-31 Thread Steven Worthington
Dear R users, I have recently begun to reuse some functions I made several months ago. The scripts write to a .csv file using the 'write.csv' function with the append option set to TRUE. This used to work fine, albeit with the warning "appending column names to file". I upgraded to R version 2.11

[R] Adding regression lines to each factor on a plot when using ANCOVA

2010-04-01 Thread Steven Worthington
Dear R users, i'm using a custom function to fit ancova models to a dataset. The data are divided into 12 groups, with one dependent variable and one covariate. When plotting the data, i'd like to add separate regression lines for each group (so, 12 lines, each with their respective individual sl

Re: [R] Using sapply on a two argument function

2010-02-11 Thread Steven Worthington
Thanks Peter, your solution worked perfectly. It also helped me realize the mistake I made in my own script - the 'k' function was returning values for 'y' between 1:10 rather than .1:1 - it should have looked like this: k <- function(s) { n <- seq(.1, s/10, .1) m

[R] Using sapply on a two argument function

2010-02-11 Thread Steven Worthington
Dear R users, I have a function (simplified here) that accepts two arguments and performs various calculations: foo <- function(y, x) { a <- y*sqrt(x) b <- a+2 c <- a*b return(c) } If I call the function as follows I get th