Re: [R] How to apply the Wilcoxon test to a hole table at once?

2009-10-23 Thread Iurie Malai
Thank you very much! This is my adapted script and now it is OK: >lapply(Dataset[3:17], function(x) wilcox.test(x ~ X2, alternative="two.sided", data=Dataset)) But it is possible to get results more compact, similar to a table? Iurie Malai Moldova Pedagogical State University Steven McKinney

Re: [R] How to apply the Wilcoxon test to a hole table at once?

2009-10-23 Thread Iurie Malai
Thank you! Here is my adapted script: >lapply(Dataset[3:17], function(x) wilcox.test(x ~ X2, alternative="two.sided", data=Dataset, subset = X2 <= 2)) but in R I have nothing, and in R Commander I have this error message: ERROR: grouping factor must have exactly 2 levels My grouping factor is

Re: [R] How to apply the Wilcoxon test to a hole table at once?

2009-10-23 Thread Steven McKinney
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Iurie Malai > Sent: Friday, October 23, 2009 10:46 AM > To: r-help@r-project.org > Subject: [R] How to apply the Wilcoxon test to a hole table at once? > > > Hi, > > I have a

Re: [R] R 64 and R: using 64-bit versions of packages in R (32)

2009-10-23 Thread David Winsemius
On Oct 23, 2009, at 8:13 PM, Richard R. Liu wrote: I'm running R 2.9.2 build 5464 on OS X 10.5.8. Having encountered memory allocation problems, I ran the problematic code in R64, the 64-bit version of the same build. When I attempt to load openNLP I receive the error message that the 32

Re: [R] Connecting to winbugs from R

2009-10-23 Thread Ben Bolker
dolberdinho wrote: > > Hi, > > I'm having trouble running a script within winbugs when calling winbugs > from R. > Here are a few lines from the winbugs log: > > display(log) > check(C:\DOCUME~1\michael\LOCALS~1\Temp\RtmpjKnHMu\mm_TO_bugs9bc21e.txt) > cannot open > C:\DOCUME~1\michael\LOCALS~

Re: [R] R 64 and R: using 64-bit versions of packages in R (32)

2009-10-23 Thread cls59
Richard Liu wrote: > > I'm running R 2.9.2 build 5464 on OS X 10.5.8. Having encountered > memory allocation problems, I ran the problematic code in R64, the 64- > bit version of the same build. When I attempt to load openNLP I > receive the error message that the 32-bit version that I h

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Gabor Grothendieck
On Fri, Oct 23, 2009 at 7:06 PM, Duncan Murdoch wrote: > Gabor Grothendieck wrote: >> >> On Fri, Oct 23, 2009 at 2:52 PM, Duncan Murdoch >> wrote: >> >>> >>> On 10/23/2009 2:49 PM, Andrew Yee wrote: >>> Thanks everyone for the responses.  As a suggestion, wouldn't it be useful, >>>

Re: [R] connecting to Oracle

2009-10-23 Thread Marc Schwartz
On Oct 23, 2009, at 2:08 PM, whizvast wrote: Hi, useR- I am connecting to Oracle database using RODBC, but keep getting this error message: library(RODBC) channel <- odbcConnect(dsn="abc", uid="abc", pwd="abc", case='oracle') Warning in odbcDriverConnect(st, ...) : [RODBC] ERROR: stat

[R] R 64 and R: using 64-bit versions of packages in R (32)

2009-10-23 Thread Richard R. Liu
I'm running R 2.9.2 build 5464 on OS X 10.5.8. Having encountered memory allocation problems, I ran the problematic code in R64, the 64- bit version of the same build. When I attempt to load openNLP I receive the error message that the 32-bit version that I had been using does not run in R

Re: [R] extract day or month as in Splus

2009-10-23 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Fang (Betty) Yang > Sent: Friday, October 23, 2009 11:06 AM > To: R-help@r-project.org > Subject: [R] extract day or month as in Splus > > Dear all, > > > > I am writing to a

Re: [R] data.frame tall skinny transformation

2009-10-23 Thread Phil Spector
Michael - I think the easiest way is to use the melt function from the reshape package: x feature 5637 1321N1 1 feature1 -0.56 -0.93 2 feature2 -0.91 -0.94 3 feature3 0.44 -0.25 library(reshape) melt(x,id.var='feature',variable_name='cell.line') feature cell.line value 1 feature

[R] making a plot in xyplot

2009-10-23 Thread Ordaz, Sarah
Hello, I am a newbie to the lattice package in R, and I'm trying to make a plot using the xyplot function. I have repeated measures data (2 conditions) for two different groups of subjects (teens and adults). So far, I've made a basic graph using xyplot(y ~x, group=subnum, data=mydata, type="

Re: [R] ggplot2: stat_bin ..count.. with geom_text when NA is present

2009-10-23 Thread Bryan Hanson
.. Adding to my original post... OK, here's a little function which demonstrates the behavior I described. Try it with rem = FALSE to see the annotation, then TRUE to see the annotations disappear. What's going on here? Thanks, Bryan res = runif(50, 0, 100) fac = rep(c("A", "B"), 50) df <- data.

[R] Connecting to winbugs from R

2009-10-23 Thread dolberdinho
Hi, I'm having trouble running a script within winbugs when calling winbugs from R. Here are a few lines from the winbugs log: display(log) check(C:\DOCUME~1\michael\LOCALS~1\Temp\RtmpjKnHMu\mm_TO_bugs9bc21e.txt) cannot open C:\DOCUME~1\michael\LOCALS~1\Temp\RtmpjKnHMu\mm_TO_bugs9bc21e.txt data(

Re: [R] data frame is killing me! help

2009-10-23 Thread bbslover
I have read that one ,I want to this method to be used to my data.but I donot know how to put my data into R. James W. MacDonald wrote: > > > > bbslover wrote: >> >> >> Steve Lianoglou-6 wrote: >>> Hi, >>> >>> On Oct 22, 2009, at 2:35 PM, bbslover wrote: >>> Usage data(gasoline) >

[R] data.frame tall skinny transformation

2009-10-23 Thread Michael Jones
Hi, I have a data.frame that looks something like this. feature 5637                1321N1 feature1 -0.568750616 -0.934748758 feature2 -0.913080902 -0.941455172 feature3 0.442477294 -0.257921866 I want to change it to look like this. feature      cell.line     value feature15637 -0.568

[R] connecting to Oracle

2009-10-23 Thread whizvast
Hi, useR- I am connecting to Oracle database using RODBC, but keep getting this error message: > library(RODBC) > channel <- odbcConnect(dsn="abc", uid="abc", pwd="abc", case='oracle') Warning in odbcDriverConnect(st, ...) : [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver M

[R] extract day or month as in Splus

2009-10-23 Thread Fang (Betty) Yang
Dear all, I am writing to ask for help to find R code to do the same thing as the following Splus code: dates <- c("02/27/1992", "02/27/1992", "01/14/1992", "02/28/1992", "02/01/1992") timeDate(as.character(dates),in.format="%m/%d/%Y","%a") [1] Thu Thu Tue Fri Sat Could anyone give me

Re: [R] opposite estimates from zeroinfl() and hurdle()

2009-10-23 Thread Brian S Cade
Tord: The logistic zero-inflation portion of the zeroinfl() implementation of ZIP or ZINB predict the probability of 0 rather than the probability of 1 (>0 counts) so the signs of the coefficients are often reversed from how you would expect them to be if you had just performed a logistic reg

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Steve Lianoglou
Sweet Jesus ... I just read what I wrote earlier ... On Oct 23, 2009, at 2:57 PM, Steve Lianoglou wrote: If this is something you just want to use on your own functions that are set to `debug`, why not just make write a debug wraps the base::debug and does some keeps track of which functions

Re: [R] interpretation of RCS 'coefs' and 'knots'

2009-10-23 Thread Dylan Beaudette
On Friday 23 October 2009, Frank E Harrell Jr wrote: > Dylan Beaudette wrote: > > Hi, > > > > I have fit a series of ols() models, by group, in this manner: > > > > l <- ols(y ~ rcs(x, 4)) > > > > ... where the series of 'x' values in each group is the same, however > > knots are not always identic

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Duncan Murdoch
Gabor Grothendieck wrote: On Fri, Oct 23, 2009 at 2:52 PM, Duncan Murdoch wrote: On 10/23/2009 2:49 PM, Andrew Yee wrote: Thanks everyone for the responses. As a suggestion, wouldn't it be useful, that when you run isdebugged() without any parameters, it would just report back the fun

Re: [R] Change positions of columns in data frame

2009-10-23 Thread Mark Na
Hi Joel, The answers you've received already, suggesting subscripting, are good because they strengthen your understanding of R subscripting. However, sometimes these methods produce "strange" column names. So, what I usually do is use the subset command. You don't have to provide anything for the

Re: [R] interpretation of RCS 'coefs' and 'knots'

2009-10-23 Thread Frank E Harrell Jr
Dylan Beaudette wrote: Hi, I have fit a series of ols() models, by group, in this manner: l <- ols(y ~ rcs(x, 4)) ... where the series of 'x' values in each group is the same, however knots are not always identical between groups. The result is a table of 'coefs' derived from the ols objects

[R] interpretation of RCS 'coefs' and 'knots'

2009-10-23 Thread Dylan Beaudette
Hi, I have fit a series of ols() models, by group, in this manner: l <- ols(y ~ rcs(x, 4)) ... where the series of 'x' values in each group is the same, however knots are not always identical between groups. The result is a table of 'coefs' derived from the ols objects, by group: group Inte

[R] Distance between axis and label adjusted automatically?

2009-10-23 Thread Lasse Kliemann
Is there a way to have the distance between label and axis adjusted automatically? This is interesting in particular for the y-axis, when it is not known in beforehand how many digits the numbers will have. It may happen then, that numbers and label overlap. All examples that I found work by e

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Peter Flom
Ravi Varadhan wrote > >I have heard this (i.e. only head-to-head comparisons are valid) and various >other folklores about AIC and BIC based model selection before, including >one that these information criteria are only applicable for comparing two >nested models. > >Where has it been demonstra

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Ben Bolker
I believe such a statement (AIC applicable to nested models only) appears in Brian Ripley. 2004. Selecting amongst large classes of models. Pages 155–170 in N. Adams, M. Crowder, D. J. Hand, and D. Stephens, editors. Methods and Models in Statistics: In Honour of Professor John Nelder, FRS.

Re: [R] cut2 once, bin twice...

2009-10-23 Thread Frank E Harrell Jr
sdanzige wrote: sdanzige wrote: Thank you, but the regular expression example doesn't seem to work correctly. I wrote a regular expression that does seem to work, so I'll post it here for anyone else that needs it. labs<-levels(df$p_bin) cbind(lower=as.numeric(sub("[[(]","",sub(",.*","",l

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Frank E Harrell Jr
Ravi Varadhan wrote: Frank, I have heard this (i.e. only head-to-head comparisons are valid) and various other folklores about AIC and BIC based model selection before, including one that these information criteria are only applicable for comparing two nested models. Where has it been demons

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Ravi Varadhan
Frank, I have heard this (i.e. only head-to-head comparisons are valid) and various other folklores about AIC and BIC based model selection before, including one that these information criteria are only applicable for comparing two nested models. Where has it been demonstrated that AIC/BIC cann

Re: [R] RMySql problem

2009-10-23 Thread Noah Silverman
Hi, It looks like you are potentially dealing with two separate issues. 1) Access - Mysql has very find grained permissions as to who can access what and from where. You need to make sure that your username in mysql is allowed to access the database/tables from your location. 2) Corruption

Re: [R] data frame is killing me! help

2009-10-23 Thread Don MacQueen
At 4:57 AM -0700 10/23/09, bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns

[R] RMySql problem

2009-10-23 Thread Robert Schneider
Hi there, I have been using RMySql for some time now without any problems until 2 weeks ago... Since then, I am only able to access some tables from within the network where the db is located. When outside, I can't. I can access some of the tables, but not all of them. This is true wether I us

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Frank E Harrell Jr
Ravi Varadhan wrote: The stepAIC() function in "MASS" can be used, with k = log(n), to implement your suggestion of "quasi-Bayesian" stepwise selection using the BIC criterion. Ravi. Although many statisticians use BIC otherwise, it was only designed to compare two pre-specified models. Fra

[R] Reporting discriminat analysis

2009-10-23 Thread Stats Wolf
Dear all, I want to report the results of discriminant analysis in a way that would enable the readers to use my results (functions) for classification of their own cases. For this it should suffice to provide discriminant functions along with the cut-off values for distinguishing the groups. Howe

[R] How to apply the Wilcoxon test to a hole table at once?

2009-10-23 Thread Iurie Malai
Hi, I have a data set: > Dataset X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 1 user1 m 22 19 28 24 12 18 9 7 4 5 4 7 5 7 9 2 user2 f 25 19 23 18 18 15 6 8 6 6 7 10 7 7 7 3 user3 f 28 21 24 18 15 12 10 6 7 9 5 10 5 9 5 4 us

Re: [R] help using R's linprog for LP

2009-10-23 Thread Medha Atre
Hi, I found the reason. By default it puts a condition for x >= 0. Is there a way to get rid of this condition? Medha On Fri, Oct 23, 2009 at 2:34 PM, Medha Atre wrote: > Hi, > > I am using R in one of my courses. I am trying to use R's linprog > package to solve to formulate 2-class classific

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Gabor Grothendieck
On Fri, Oct 23, 2009 at 2:52 PM, Duncan Murdoch wrote: > On 10/23/2009 2:49 PM, Andrew Yee wrote: >> >> Thanks everyone for the responses.  As a suggestion, wouldn't it be >> useful, >> that when you run isdebugged() without any parameters, it would just >> report >> back the functions that are be

Re: [R] reference for mahalanobis {stats}

2009-10-23 Thread Peng Yu
On Fri, Oct 23, 2009 at 10:59 AM, Steve Lianoglou wrote: > Hi, > > On Oct 23, 2009, at 11:36 AM, Peng Yu wrote: > >> The help on mahalanobis {stats} does not include any reference. I'm >> interested in understand why Mahalanobis is defined in its current way >> and how to use it. Could somebody po

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Steve Lianoglou
Hi, On Oct 23, 2009, at 2:39 PM, Gabor Grothendieck wrote: On Fri, Oct 23, 2009 at 2:34 PM, Duncan Murdoch wrote: On 10/23/2009 2:27 PM, Gabor Grothendieck wrote: I have often wanted to get such a list as well without having to write code myself. If a function which automatically iter

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Ravi Varadhan
The stepAIC() function in "MASS" can be used, with k = log(n), to implement your suggestion of "quasi-Bayesian" stepwise selection using the BIC criterion. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Ce

[R] Data format for KSVM

2009-10-23 Thread Noah Silverman
Hi, I have a process using svm from the e1071 library. it works. I want to try using the KSVM library instead. The same data used wiht e1071 gives me an error with KSVM. My data is a data.frame. sample code: svm_formula <- formula(y ~ a + B + C) svm_model <- ksvm(formula, data=train_data

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Duncan Murdoch
On 10/23/2009 2:49 PM, Andrew Yee wrote: Thanks everyone for the responses. As a suggestion, wouldn't it be useful, that when you run isdebugged() without any parameters, it would just report back the functions that are being flagged for debugging? Could you give an example of what the answer

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Andrew Yee
Thanks everyone for the responses. As a suggestion, wouldn't it be useful, that when you run isdebugged() without any parameters, it would just report back the functions that are being flagged for debugging? Andrew On Fri, Oct 23, 2009 at 2:12 PM, Yihui Xie wrote: > Oops... I forgot to mention

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Gabor Grothendieck
On Fri, Oct 23, 2009 at 2:34 PM, Duncan Murdoch wrote: > On 10/23/2009 2:27 PM, Gabor Grothendieck wrote: >> >> I have often wanted to get such a list as well without having to write >> code myself.  If  a function which automatically iterated over all >> possible objects and listed out the ones t

[R] help using R's linprog for LP

2009-10-23 Thread Medha Atre
Hi, I am using R in one of my courses. I am trying to use R's linprog package to solve to formulate 2-class classification problem as Linear programming problem. For my formulation, I need to set to "cvec" to all 0s. I know the points are linearly separable so an optimal solution "x" does exist,

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Duncan Murdoch
On 10/23/2009 2:27 PM, Gabor Grothendieck wrote: I have often wanted to get such a list as well without having to write code myself. If a function which automatically iterated over all possible objects and listed out the ones that being debugged were available in the core it would be useful. E

[R] Prediction Error Calculation

2009-10-23 Thread quaildoc
Hello List, I am fitting a logistic regression model for some presence/absence type data. I have numerous covariates I am fitting to explain variation, and I am using AIC to rank models. However, I would like to report how well my best model (s) do at prediction. I have looked over the archive

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread JLucke
The BIC (Raftery) can be used for quasi-Bayesian model selection, but it's not stepwise. Ntzoufras shows how to use WinBUGS to conduct Bayesian model selection, but again it's not stepwise Ntzoufras, I. (2002), 'Gibbs variable selection using BUGS', Journal of Statistical Software 7(7), 1--1

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Gabor Grothendieck
I have often wanted to get such a list as well without having to write code myself. If a function which automatically iterated over all possible objects and listed out the ones that being debugged were available in the core it would be useful. Even if its slow this would be used at debug time an

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Yihui Xie
Oops... I forgot to mention that 'envir' (or 'pos') should be specified in ls()/get() in my last reply if you are looking for debugged functions in environments other than ".GlobalEnv". Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State Uni

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Duncan Murdoch
On 10/23/2009 1:28 PM, Andrew Yee wrote: This is kind of a dumb question: I know you can use isdebugged() to find out if a specific function is flagged for debugging, but is there a way to list all the functions that are flagged for debugging? No, R doesn't keep any master list, it sets a flag

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Yihui Xie
list all objects first; use a loop (explicitly or not) to check whether (1) your objects are functions (2) functions are debugged > f = function(x) x > g = 1 > x = ls() > debug(f) > sapply(x[sapply(x, function(i) is.function(get(i)))], isdebugged) f TRUE > undebug(f) > sapply(x[sapply(x, functi

Re: [R] Bonferroni with unequal sample sizes

2009-10-23 Thread Chuck Cleland
On 10/23/2009 1:30 PM, slrei...@vims.edu wrote: > Hello- >I have run an ANOVA on 4 treatments with unequal sample sizes (n=9,7,10 > and 10). I want to determine where my sig. differences are between > treatments using a Bonferroni test, and have run the code: > > pairwise.t.test(Wk16, Treat

[R] Bonferroni with unequal sample sizes

2009-10-23 Thread slreiner
Hello- I have run an ANOVA on 4 treatments with unequal sample sizes (n=9,7,10 and 10). I want to determine where my sig. differences are between treatments using a Bonferroni test, and have run the code: pairwise.t.test(Wk16, Treatment, p.adf="bonf") I receive an error message stating that

[R] how do you know which functions are being debugged?

2009-10-23 Thread Andrew Yee
This is kind of a dumb question: I know you can use isdebugged() to find out if a specific function is flagged for debugging, but is there a way to list all the functions that are flagged for debugging? Thanks, Andrew [[alternative HTML version deleted]] _

Re: [R] Memory Problems with CSV and Survey Objects

2009-10-23 Thread tlumley
Yes, a 350Mb data frame is a bit big for 32-bit R to handle conveniently. As you note, the survey package doesn't yet do database-backed replicate-weight designs. You can get the same effect yourself without too much work. First, put the data into a database, such as SQLite. If you have the

[R] ggplot2: stat_bin ..count.. with geom_text when NA is present

2009-10-23 Thread Bryan Hanson
One for the ggplot2 gurus... I have a function which makes a plot just fine if the response vector (res in the example; fac1 is a factor) has no NA in it. It plots the data, then makes a little annotation at the bottom with the data counts using: p <- p + geom_text(aes(x = fac1, y = min(res)

Re: [R] coxph() and survfit()

2009-10-23 Thread tlumley
On Thu, 22 Oct 2009, Mura Tamakou wrote: Dear All, I have a question regarding the output of survfit() when I supply a Cox model. Lets say for example: we observe that the 95% CIs overlap!! How is this possible since the HR for spiders is significant. It's perfectly natural. To a goo

[R] Error: NA/NaN/Inf in foreign function call (arg 1)

2009-10-23 Thread Rainier Sabangan
Hi, Below is the code that is giving me this error message: #=== #The code below results in error: Error: NA/NaN/Inf in foreign function #call (arg 1) #=== A=rep(c(-1,1

[R] Capturing lagged values?

2009-10-23 Thread Arthur Burke
Consider a data structure where "header" rows supply ID values (school and grade in the example below) that are not captured in subsequent rows df <- read.table(textConnection(" school grade studentid score 101 5 NA NA NA NA 123 21 NA NA 124 25 201 6 NA NA NA NA 231 33"), header=TRUE) close

Re: [R] How to make R packages?

2009-10-23 Thread David M Smith
On Fri, Oct 23, 2009 at 12:10 AM, Peng Yu wrote: > I found the following document on making R packages. But it is old. > I'm wondering if there is more current ones and hopefully more > complete ones. Friedrich Leisch made an excellent tutorial for making R packages, with a tutorial that works in

Re: [R] Change positions of columns in data frame

2009-10-23 Thread Tom Gottfried
You can change the order of nearly everything just by applying an appropriate index and assigning to the original object. Something like data <- data[,order_of_columns] Tom Joel Fürstenberg-Hägg schrieb: > Hi all, > > Probably a simple question, but I just can't find a simple answear in the >

Re: [R] Determining which file is newer

2009-10-23 Thread Barry Rowlingson
On Fri, Oct 23, 2009 at 5:02 PM, Dennis Fisher wrote: > Colleagues, > > I wish to execute a task only if a particular file is newer than a second > file.  I can access the file modification dates using file.info()$mtime. > This yields a time object (? POSIX). >                        size    isdir

Re: [R] Determining which file is newer

2009-10-23 Thread Henrik Bengtsson
Have a look at your company name and your phone number. Nudge nudge, wink wink, say no more... /H On Fri, Oct 23, 2009 at 9:02 AM, Dennis Fisher wrote: > Colleagues, > > I wish to execute a task only if a particular file is newer than a second > file.  I can access the file modification dates us

Re: [R] arima crashes too

2009-10-23 Thread Alberto Monteiro
Barry Rowlingson wrote: > > If you're doing anything in a loop that has the potential to fail > because of singularities or other conditions when your model can't be > fitted, you need to stick what you are doing in a 'try' clause. This > lets you trap errors and do something with them. > > Pl

Re: [R] opposite estimates from zeroinfl() and hurdle()

2009-10-23 Thread Ben Bolker
Tord Snäll-4 wrote: > > Dear all, > A question related to the following has been asked on R-help before, but > I could not find any answer to it. Input will be much appreciated. > > I got an unexpected sign of the "slope" parameter associated with a > covariate (diam) using zeroinfl(). It le

[R] Determining which file is newer

2009-10-23 Thread Dennis Fisher
Colleagues, I wish to execute a task only if a particular file is newer than a second file. I can access the file modification dates using file.info()$mtime. This yields a time object (? POSIX). sizeisdir modemtime ctime

Re: [R] reference for mahalanobis {stats}

2009-10-23 Thread Steve Lianoglou
Hi, On Oct 23, 2009, at 11:36 AM, Peng Yu wrote: The help on mahalanobis {stats} does not include any reference. I'm interested in understand why Mahalanobis is defined in its current way and how to use it. Could somebody point me a good book on this? I have looked through a few books, but they

Re: [R] cut2 once, bin twice...

2009-10-23 Thread sdanzige
sdanzige wrote: > > > Thank you, but the regular expression example doesn't seem to work > correctly. > > I wrote a regular expression that does seem to work, so I'll post it here for anyone else that needs it. labs<-levels(df$p_bin) cbind(lower=as.numeric(sub("[[(]","",sub(",.*","",labs)))

Re: [R] Change positions of columns in data frame

2009-10-23 Thread Phil Spector
Joel - Suppose the columns are named x1, x2, x3, x4, and x5. You can use subscripting: x[c('x2','x4','x1','x3','x5')] or, to save typing the quotes subset(x,select=c(x2,x4,x1,x3,x5)) - Phil Spector Statist

Re: [R] cut2 once, bin twice...

2009-10-23 Thread sdanzige
Dieter Menne wrote: > > > It used to be quite tricky, but on popular request Brian Ripley has added > an example how to extract the intervals using regular expression on the > bottom of the examples for cut (note:cut in base, not cut2 in Hmisc). > > Thank you, but the regular expression exa

[R] reference for mahalanobis {stats}

2009-10-23 Thread Peng Yu
The help on mahalanobis {stats} does not include any reference. I'm interested in understand why Mahalanobis is defined in its current way and how to use it. Could somebody point me a good book on this? I have looked through a few books, but they all give very light explanation on it.

Re: [R] How to make R packages?

2009-10-23 Thread Steve Lianoglou
Hi Pen, On Oct 23, 2009, at 10:31 AM, Peng Yu wrote: These two are for windows. I have a linux machine. Are there any other reference for linux? The steps are pretty much the same. For instance, in robjhyndman.com link, you can simply start from step 2 and go on. Also, the official "Writi

Re: [R] reset par() within plot layout

2009-10-23 Thread Peter Ehlers
Janke ten Holt wrote: Tom Gottfried wrote: Janke, Janke ten Holt schrieb: Dear list, I would like to produce a matrix of plots, where par() is reset after each plot (see below [simplified] example). When I use layout() to do so, I seem to also reset the layout. I have not been able to figu

Re: [R] Functional data analysis - problems with smoothing

2009-10-23 Thread spencerg
'isi' has only 14 values, 'age' has 31. The help page for 'smooth.basis' says, "argvals: a vector of argument values correspond to the observations in array 'y'." I think 'isi' and 'age' should have the same length. I apologfize if the error message was, uh, cryptic.

Re: [R] How to find moving averages within each subgroup of a data frame

2009-10-23 Thread Gabor Grothendieck
Try this: df1$SMA <- ave(df1$col4, df1$col1, FUN = function(x) c(NA, (head(x, -1) + tail(x, -1))/2)) It would also be possible to convert it from long form to wide form using reshape (or read.zoo in the devel version of zoo), convert that to a zoo series and the use rollapply in the zoo package.

Re: [R] cut2 once, bin twice...

2009-10-23 Thread Gabor Grothendieck
On Fri, Oct 23, 2009 at 3:58 AM, Dieter Menne wrote: > > > > sdanzige wrote: >> >> >> I'm using the Hmisc cut2 function to bin a set of data.  It produces bins >> that I like with results like this: >> >> [96,270]:171 >> [69, 96): 54 >> [49, 69): 40 >> [35, 49): 28 >> [28, 35): 14 >> [24, 28):  8

Re: [R] removing random effect from nlme or using varPower() in nls

2009-10-23 Thread Michael A. Gilchrist
Hi Kingsford, That's exactly what I was looking for! Thanks. Mike On Thu, 22 Oct 2009, Kingsford Jones wrote: help(gnls, pack=nlme) hth, Kingsford Jones On Thu, Oct 22, 2009 at 4:36 PM, Michael A. Gilchrist wrote: Hello, I've been fitting a random effects model using nlme to some data

Re: [R] standard errors in bbmle

2009-10-23 Thread Ben Bolker
Peter Dalgaard wrote: > > alexander russell wrote: >> Hello, >> Mle2 is a little unforthcoming in the matter of standard errors? Is there >> a >> way to ask the program to supply standard errors along with estimates in >> cases when it doesn't print them 'voluntarily'? >> regards, >> s > > Wha

Re: [R] Change positions of columns in data frame

2009-10-23 Thread Peter Ehlers
DF[ ,names(DF)[c(your_preferred_order)]] -Peter Ehlers Joel Fürstenberg-Hägg wrote: Hi all, Probably a simple question, but I just can't find a simple answear in the older threads or anywhere else. I've added some new vectors as columns in a data frame using cbind(). As they're all put as

[R] Documenting related data sets

2009-10-23 Thread Michael Friendly
Say I want to include the data from Minard's march on Moscow graphic in a package. They consist of three data frames, Minard.troops, Minard.cities, Minard.temp. I've determined that I can document them all in one .Rd file, Minard.Rd, that starts: \name{Minard} \Rdversion{1.1} \alias{Minard}

Re: [R] How to make R packages?

2009-10-23 Thread Peng Yu
These two are for windows. I have a linux machine. Are there any other reference for linux? On Fri, Oct 23, 2009 at 12:08 AM, Jorge Ivan Velez wrote: > Hi Peng, > Also, take a look at the following links: > http://robjhyndman.com/research/Rpackages_notes.pdf > http://www.biostat.wisc.edu/~kbroman

[R] Nested logit in GEV family

2009-10-23 Thread Min Chen
Hi All, I know someone has posted similar messages before, but there is no reply. So I wonder whether there is a way to run a nested logit model in R. It is in the GEV family; however, the commands fitting GEV don't seem to work for nested logit. Or maybe I have to write down the log-liklihood

Re: [R] Change positions of columns in data frame

2009-10-23 Thread John Kane
dataframe xx x1 x2 x3 1 2 5 2 4 1 5 6 0 1 1 2 data.frame(xx$x2,xx$x1,xx$x3) # or Awkward but works --- On Fri, 10/23/09, Joel Fürstenberg-Hägg wrote: > From: Joel Fürstenberg-Hägg > Subject: [R] Change positions of columns in data frame > To: r-help@r-project.org > Received:

Re: [R] PDF too large, PNG bad quality

2009-10-23 Thread Vijaya Parthiban
Hello Lasse, Why not try this? (1) Create 20MB PDF from R (2) use convert command in linux, examples below: convert -resize 50% <20mbfile.pdf> convert -resize 75% <20mbfile.pdf> Ghostscript can help you as well for conversion! Using vector formats (pdf,ps,eps) are good for this purpose, as op

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Ravi Varadhan
"If 'fools rush in where angels fear to tread', then Bayesians 'jump' in where frequentists fear to 'step'..." Very nice, Chuck! Definitely one for my list of "fortunes". Ravi. --- Ravi Varadhan, Ph.D. Assistant

[R] Change positions of columns in data frame

2009-10-23 Thread Joel Fürstenberg-Hägg
Hi all, Probably a simple question, but I just can't find a simple answear in the older threads or anywhere else. I've added some new vectors as columns in a data frame using cbind(). As they're all put as the last columns inte the data frame, I would like to move them to specific positions.

Re: [R] Inserting rows

2009-10-23 Thread John Kane
?rbind df1 <- data.frame(matrix(rep(0,9),nrow=3)) names(df1) <- c("x1","x2","x3") rbind(df,df1) --- On Fri, 10/23/09, Ashta wrote: > From: Ashta > Subject: [R] Inserting rows > To: "R help" > Received: Friday, October 23, 2009, 9:44 AM > Hi all, > > I have the data set  df with three varaib

Re: [R] Functional data analysis - problems with smoothing

2009-10-23 Thread Peter Ehlers
Ben, I lose my bet! Good thing my opinion is never worth more than $.02. Looking at the code for smooth.spline() I see that, although 'argvals' is the first argument to the function, the error message is generated by the second argument. [** Spencer, is this intentional? **] So, Ben, try str(r

Re: [R] reset par() within plot layout

2009-10-23 Thread Janke ten Holt
Tom Gottfried wrote: > Janke, > > Janke ten Holt schrieb: >> Dear list, >> >> I would like to produce a matrix of plots, where par() is reset after >> each plot (see below [simplified] example). When I use layout() to do >> so, I seem to also reset the layout. I have not been able to figure out

Re: [R] reset par() within plot layout

2009-10-23 Thread Tom Gottfried
Janke, Janke ten Holt schrieb: > Dear list, > > I would like to produce a matrix of plots, where par() is reset after > each plot (see below [simplified] example). When I use layout() to do > so, I seem to also reset the layout. I have not been able to figure out > how to prevent this from happen

Re: [R] data frame is killing me! help

2009-10-23 Thread James W. MacDonald
bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns. The NIR spectrum and I see the

Re: [R] Inserting rows

2009-10-23 Thread Henrique Dallazuanna
Try this: rbind(df, matrix(0, 3, 3, dimnames = list(NULL, names(df On Fri, Oct 23, 2009 at 11:44 AM, Ashta wrote: > Hi all, > > I have the data set  df with three varaibles, > > x1 x2 x3 > 1  2   5 > 2  4   1 > 5  6   0 > 1  1   2 > > I want to insert more rows ( eg, 3 rows with value  fill

Re: [R] access elements of a named list using a factor

2009-10-23 Thread Robin Hankin
Hello Dimitris thanks for this. It works! I guess I was fixated on the dollar sign. I must confess that I don't really understand any of the error messages below. Can anyone help me interpret them? rksh Dimitris Rizopoulos wrote: do you mean: f <- factor(c("pigs", "pigs", "slugs")) jj

[R] Inserting rows

2009-10-23 Thread Ashta
Hi all, I have the data set df with three varaibles, x1 x2 x3 1 2 5 2 4 1 5 6 0 1 1 2 I want to insert more rows ( eg, 3 rows with value filled with zeros) 1 2 5 2 4 1 5 6 6 1 1 2 0 0 0 0 0 0 0 0 0 Can any body help me out? Thanks __

Re: [R] access elements of a named list using a factor

2009-10-23 Thread Dimitris Rizopoulos
do you mean: f <- factor(c("pigs", "pigs", "slugs")) jj <- list(pigs = 1:10, slugs = 1:3) jj[levels(f)[1]] jj[[levels(f)[1]]] Best, Dimitris Robin Hankin wrote: Hi I have a factor 'f' and a named list 'jj'. I want names(jj) to match up with levels(f). How do I use levels(f) to access ele

[R] Memory Problems with CSV and Survey Objects

2009-10-23 Thread Anthony Damico
I'm working with a 350MB CSV file on a server that has 3GB of RAM, yet I'm hitting a memory error when I try to store the data frame into a survey design object, the R object that stores data for complex sample survey data. When I launch R, I execute the following line from Windows: "C:\Program Fi

[R] access elements of a named list using a factor

2009-10-23 Thread Robin Hankin
Hi I have a factor 'f' and a named list 'jj'. I want names(jj) to match up with levels(f). How do I use levels(f) to access elements of jj? > f <- factor(c("pigs","pigs","slugs")) > f [1] pigs pigs slugs Levels: pigs slugs > > jj <- list(pigs=1:10,slugs=1:3) My attempts to produce jj$pig

  1   2   >