Re: [R] Details of subassignment (for vectors and data frames)

2011-08-12 Thread Jeff Newmiller
My mental model is that the left hand side forms a sort of virtual vector where each element really points to an element in the vector being modified. Then the right hand side scalar is extended in the usual repetitious way (if necessary) until it is a vector just as long as the virtual vector

[R] current.panel.limits() of lattice returning NaN limits - why?

2011-08-12 Thread Fredrik Karlsson
Hi, I need a custom axis function for a plot, but it seems that current.panel.limits() sometimes returns NaN limits for the plot, which it much harder to calculate anything sensible. An illustration: Given this axis function: vs.axis - function(...){ xlim - current.panel.limits()$xlim

Re: [R] value.labels

2011-08-12 Thread David Winsemius
On Aug 11, 2011, at 10:27 AM, Uwe Ligges wrote: On 11.08.2011 19:22, David Winsemius wrote: Hmm, when you want to add a level without changing the class of the factor object, you will have to add the level at first and then assign the level to the elements of the object. I'd probably

[R] Extract named regions from an Excel file using XLConnect?

2011-08-12 Thread christiaan pauw
Hi Everybody In R, the XLConnect package can read and write named region to and from Excel. In order to read a named region with the readNamedRegion function you need to know it's name. You can check is a name exists with existsName, but you still have to know the name. Is there a way to actually

Re: [R] current.panel.limits() of lattice returning NaN limits - why?

2011-08-12 Thread Deepayan Sarkar
On Fri, Aug 12, 2011 at 12:15 PM, Fredrik Karlsson dargo...@gmail.com wrote: Hi, I need a custom axis function for a plot, but it seems that current.panel.limits() sometimes returns NaN limits for the plot, which it much harder to calculate anything sensible. An illustration: Given this

Re: [R] help with loops

2011-08-12 Thread Paul Hiemstra
On 08/11/2011 07:51 PM, William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of R. Michael Weylandt Sent: Thursday, August 11, 2011 10:09 AM To: Srinivas Iyyer Cc: r-help@r-project.org Subject: Re: [R] help

Re: [R] Splitting data

2011-08-12 Thread Marina de Wolff
Thank you for your reply, I used this code on my test data, but did not get the same p-values. I think I know were the difference lies; when the data is split in 4 parts I want to compare the two left groups (group 1 and 2) with each other and the two right groups (group 3 and 4) with each

[R] UNC windows path beginning with backslashes: normalizePath bug??

2011-08-12 Thread Keith Jewell
Hi, Back in June I posted the message below, but had no replies. I've made a little progress since then so this is to update anyone interested (!) and to ask for comments. Brief problem statement: Under Windows, some parts of R don't handle UNC paths beginning with backslashes. Specifically

Re: [R] value.labels

2011-08-12 Thread Jim Lemon
On 08/12/2011 12:10 AM, zcatav wrote: Hello R people, I have a data.frame. Status variable has 3 values. 0-alive, 1-dead and 2-missed Status as a factor have correct levels. Levels and labels output as follows; levels(Adbf$status); labels(Adbf$status) [1] 0 1 2 [1] 1 2 3 4 5 6 7

Re: [R] improve formatting of HTML table

2011-08-12 Thread Jim Lemon
On 08/12/2011 02:04 AM, Juliet Hannah wrote: I am trying to improve the look of an HTML table for a report (that needs to be pasted into Word). Here is an example. table2- structure(c(26L, 0L, 40L, 0L, 10L, 0L, 0L, 188L, 0L, 281L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L), .Dim = c(6L, 3L), .Dimnames =

Re: [R] UNC Windows path beginning with backslashes: normalizePath bug??

2011-08-12 Thread Keith Jewell
Thanks Uwe. I'm aware (and have been forcefully reminded) that using a mapped drive avoids these problems. But there is no single drive letter which I can use site-wide, so I have problems with things like R_LIBS_SITE. As I've outlined I'm exploring a range of solutions, including mapping a

[R] odfWeave repeats output

2011-08-12 Thread Chris Beeley
Hello all- I'm having a problem with odfWeave. I'm still testing it out, and have used both of these code chunks, which I copied off a blog: Number 1: A sample document last processed \Sexpr{Sys.time()}. This simply illustrates the output from an R command inserted into our document. This is

Re: [R] 5 arguments passed to .Internal(matrix) which requires 7

2011-08-12 Thread Uwe Ligges
You obviously have a combination from R code in package base and compiled C code of base R that do not match. Point is that the matrix R code passes 7 arguments to the underlying .Internal code that should also expect 7 arguments. If just 5 are passes the R code is from an ancient version of

Re: [R] odfWeave repeats output

2011-08-12 Thread Rainer Stuetz
On Fri, Aug 12, 2011 at 11:10 AM, Chris Beeley chris.bee...@gmail.com wrote: I'm having a problem with odfWeave. I'm still testing it out, and have used both of these code chunks, which I copied off a blog: ... The really weird thing is that I have replicated the problem across two

Re: [R] value.labels

2011-08-12 Thread Bert Gunter
Doesn't: x - sample(0:2,100,TRUE) y - structure(factor(x,labels=c(alive,dead,missed)), orig.labs=x) do what you want? -- Bert The OP wanted to associate the label alive with the value 0, but didn't want the underlying value in x to change.  The construction y -

Re: [R] Extract named regions from an Excel file using XLConnect?

2011-08-12 Thread Gabor Grothendieck
On Fri, Aug 12, 2011 at 3:15 AM, christiaan pauw cjp...@gmail.com wrote: Hi Everybody In R, the XLConnect package can read and write named region to and from Excel. In order to read a named region with the readNamedRegion function you need to know it's name. You can check is a name exists

Re: [R] attribute name argument for getAttrib()

2011-08-12 Thread Duncan Murdoch
On 11-08-11 5:46 PM, Wei Hao wrote: Hi all: Having browsed Rinternals.h, it's a little unclear to me how to get attributes that aren't in the Symbol Table Shortcuts section of that file. In particular, I would like to extract the attribute scaled:center from a SEXP. This is an R-devel

Re: [R] Splitting data

2011-08-12 Thread R. Michael Weylandt
Yes, that likely is the source of the difference: I'm happy to help fix it up (won't be hard), but I want to clarify exactly how you want the data done: say we have 20 variables x = 1:20 if there's a split we go to 1:10, 11:20; then 1:5, 6:10, 11:15,16:20 etc but what about situations with very

Re: [R] Extract values from a data frame

2011-08-12 Thread Ista Zahn
On Fri, Aug 12, 2011 at 3:54 AM, Lali laur...@gmail.com wrote: Hi Ista, Thanks for your suggestion, I am still trying to wrap my head around the functions you used, as I am not familiar with any of them, but it works perfectly! I do want to understand the code, if you don't mind I would like

[R] Getting bootstrap statistic to work

2011-08-12 Thread Alex Olssen
Hi R-help, I am trying to implement a nonparametric bootstrap to find the standard errors of a simple statistics - the ratio of two scalars. I am having difficulty getting boot() to work correctly. I code a function to create the ratio of the relevant scalars. theta(data, i). When I call the

Re: [R] Getting bootstrap statistic to work

2011-08-12 Thread Ken Hutchison
Hi, It's kind of weird for me to not see a return() statement in the function. Maybe try rolling your own, nonparametric bootstraps aren't all that bad. i.e. reps=1000 stat.holder=rep(NA,reps) ###Rep of NA's so you can pick up errors easily for(count in 1:reps) { bootsample=sample(data,

Re: [R] Reduce the space under legend title

2011-08-12 Thread Uwe Ligges
On 12.08.2011 01:28, Amelia McNamara wrote: I would like to know if there is a way to reduce the space between the legend title and the first line of the legend, without reducing all the vertical space using y.intersp. Because of lack of space, I would like to differentiate my title by bolding

[R] install packages from intranet

2011-08-12 Thread Peter Aberline
Hi, I'm new to R. Apologies if this is a simple query, I've searched the mailing lists and docs but can't find a solution to my problem. I'm trying to make some packages available on our intranet. During development the 'intranet' is a webserver running on localhost. * When I call

[R] deSolve output

2011-08-12 Thread bosse
Hi, I've solved a simple differential equation describing the degradation of amino acid carbon (THAA-C) using deSolve. Code is a follows: # Input of model parameters, a and b describes form of curve, i is apparent initial age of Org. C. parameters - c(a = a, b = b, i=i) # Initial

Re: [R] Removing all duplicate row except by one

2011-08-12 Thread m.marcinmichal
Hi, thanks for response it's work perfect. Yes 't' is not good wariable it will be 'test', my wrong. Best Marcin M. -- View this message in context: http://r.789695.n4.nabble.com/Removing-all-duplicate-row-except-by-one-tp3736949p3738132.html Sent from the R help mailing list archive at

[R] sapply to bind columns, with repeat?

2011-08-12 Thread Katrina Bennett
Hi R-help, I am working with US COOP network station data and the files are concatenated in single rows for all years, but I need to pull these apart into rows for each day. To do this, I need to extract part of each row such as station id, year, mo, and repeat this against other variables in the

[R] EXPORTING VERY LARGE DATASETS FROM R - PLEASE HELP!

2011-08-12 Thread BeckyHolt
Hi, Im trying to export a very large dataset from R after i have perfomed a predict function. I have tried saving the data as an object and then exporting via write.table but it is too big to fit into both a txt file and an excel.csv file...the following error occyrs : clipboard buffer is full

Re: [R] Extract values from a data frame

2011-08-12 Thread Lali
Hi Ista, Thanks for your suggestion, I am still trying to wrap my head around the functions you used, as I am not familiar with any of them, but it works perfectly! I do want to understand the code, if you don't mind I would like to ask a few questions In this line: dfm - melt(df[c(1, 2, 5, 8)],

Re: [R] value.labels

2011-08-12 Thread zcatav
Hi, My data.frame as follows; a b c d 1 58009 2010-11-02 0 NA 2 114761 2011-07-28 1 2008-11-05 3 184440 2011-07-28 1 2009-12-08 4 189372 2011-07-28 0 NA 5 105286 NA

Re: [R] value.labels

2011-08-12 Thread zcatav
Jim Lemon wrote: On 08/12/2011 12:10 AM, zcatav wrote: Hello R people, I have a data.frame. Status variable has 3 values. 0-alive, 1-dead and 2-missed Status as a factor have correct levels. Levels and labels output as follows; levels(Adbf$status); labels(Adbf$status) [1] 0 1 2

[R] Can the environment of a function be specified when the function is defined?

2011-08-12 Thread Frederic F
Hello, Is there a syntax to set the environment of a function when this function is defined? The best I could come up with so far is using a wrapper function: foo_internals- function(x) {Code of the function} foo- function(x) { environment(foo_internals)-as.environment(target_environment)

Re: [R] Finding dependancies?

2011-08-12 Thread Uwe Ligges
On 03.08.2011 09:03, Rainer M Krug wrote: Hi although the background is that it happened on an hpc cluster, this question does *not* concern hpc computing with R. I was using R on a cluster and had to install several packages in my home directory. Now the head node was migrated to new

Re: [R] Getting bootstrap statistic to work

2011-08-12 Thread Jean V Adams
Shouldn't the i in your theta() function refer to the selected rows (a vector of indices as referred to in the help file for boot) of the data used by boot()? theta - function(data, i) { data - data[i, ] data.cov - cov(data) data.eigen - eigen(data.cov)

Re: [R] Can the environment of a function be specified when the function is defined?

2011-08-12 Thread Uwe Ligges
I doubt what you have in mind makes too much sense, but changing the environment of a function foo to and environment env can be done using environment(foo) - env Uwe Ligges On 12.08.2011 16:45, Frederic F wrote: Hello, Is there a syntax to set the environment of a function when this

Re: [R] install packages from intranet

2011-08-12 Thread Uwe Ligges
On 12.08.2011 11:40, Peter Aberline wrote: Hi, I'm new to R. Apologies if this is a simple query, I've searched the mailing lists and docs but can't find a solution to my problem. I'm trying to make some packages available on our intranet. During development the 'intranet' is a webserver

Re: [R] EXPORTING VERY LARGE DATASETS FROM R - PLEASE HELP!

2011-08-12 Thread Uwe Ligges
On 12.08.2011 12:23, BeckyHolt wrote: Hi, Im trying to export a very large dataset from R after i have perfomed a predict function. I have tried saving the data as an object and then exporting via write.table but it is too big to fit into both a txt file and an excel.csv file...the following

[R] lattice panel.abline use

2011-08-12 Thread jjap
Dear R-users, I am unsuccessful in trying to add an horizontal line to all graphs in the example below: library(lattice) val-runif(15) x-rep(seq(1:5),3) type-c(rep(a,5), rep(b,5), rep(c,5)) xyplot(val ~ x | type, panel.abline(h=.6)) Any hints are appreciated. Best regards, ---Jean -- View

[R] Which Durbin-Watson is correct? (weights involved) - using durbinWatsonTest and dwtest (packages car and lmtest)

2011-08-12 Thread Dimitri Liakhovitski
Hello! I have a data frame mysample (sorry for a long way of creating it below - but I need it in this form, and it works). I regress Y onto X1 through X11 - first without weights, then with weights: regtest1-lm(Y~., data=mysample[-13])) regtest2-lm(Y~.,

Re: [R] Splitting data

2011-08-12 Thread R. Michael Weylandt
Hmmm, interesting problem. I now see your motivation for not using a data frame set up in the split code: try this -- DataSplits - function(Data, alpha = 0.05) { DataSplitsCore - function(Data1,Data2, alpha, level) { tt - t.test(Data1,Data2) print(tt) if (tt$p.value

Re: [R] Splitting data

2011-08-12 Thread R. Michael Weylandt
Sorry -- missed a tweak. The call to DataSplitsCore should read nr = floor(NROW(Data)/2); Data1 = Data[(1:nr)]; Data2 = Data[-(1:nr)]; DataSplitsCore(Data1,Data2,alpha,level) On Fri, Aug 12, 2011 at 11:46 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Hmmm, interesting problem. I

Re: [R] lattice panel.abline use

2011-08-12 Thread Mikhail Titov
I hope this helps: xyplot(val ~ x | type, panel=function(...) { panel.xyplot(...) panel.abline(h=.6) }) Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jjap Sent: Friday, August 12,

[R] recode Variable in dependence of values of two other variables

2011-08-12 Thread Julia Moeller
Hi, as an R-beginner, I have a recoding problem and hope you can help me: I am working on a SPSS dataset, which I loaded into R (load(C:/...) I have 2 existing Variables: ID and X , and one variable to be computed: meanX.dependID (=mean of X for all rows in which ID has the same value) ID

[R] Standard error bars on bar plots

2011-08-12 Thread Christopher Crooks
Hi, I know there have been numerous posts about this but I am unable to find one, or at least carry out one, that gives me the plot I want. I have managed to add the error bars to the plot, but they end up not aligned with the centre of the bars themselves. Here is my script:

[R] rollapply.zoo() with na.rm=TRUE

2011-08-12 Thread Giles
Hi. I'm comparing output from rollapply.zoo, as produced by two versions of R and package zoo. I'm illustrating with an example from a R-help posting 'Zoo - bug ???' dated 2010-07-13. My question is not about the first version, or the questions raised in that posting, because the behaviour is

[R] Plotting and quantiles

2011-08-12 Thread Mark D.
Dear R users, This is most likely very basic question but I am new to R and would really appreciate some tips on those two problems. 1) I need to plot variables from a data frame. Because of some few high numbers my graph is really strange looking. How could I plot a fraction of the samples

[R] problem in asreml function in wgaim package

2011-08-12 Thread ram basnet
Dear R users,   I am trying to use wgaim package for QTL analysis using mixed model approach. But i am stuck with asreml function while using wgaim package. Do i need a separate package to activate asreml function beside wgaim package ?   If so, i tried to download Asreml-R package (i guess this

Re: [R] Standard error bars on bar plots

2011-08-12 Thread Uwe Ligges
On 12.08.2011 18:43, Christopher Crooks wrote: Hi, I know there have been numerous posts about this but I am unable to find one, or at least carry out one, that gives me the plot I want. I have managed to add the error bars to the plot, but they end up not aligned with the centre of the bars

Re: [R] recode Variable in dependence of values of two other variables

2011-08-12 Thread Mikhail Titov
?aggregate aggregate(X~ID, your.data.frame.goes.here, mean) Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Julia Moeller Sent: Friday, August 12, 2011 10:10 AM To: r-help@r-project.org Subject: [R] recode Variable

Re: [R] problem in asreml function in wgaim package

2011-08-12 Thread Uwe Ligges
On 12.08.2011 18:58, ram basnet wrote: Dear R users, I am trying to use wgaim package for QTL analysis using mixed model approach. But i am stuck with asreml function while using wgaim package. Do i need a separate package to activate asreml function beside wgaim package ? If so, i tried

Re: [R] Standard error bars on bar plots

2011-08-12 Thread Mikhail Titov
Or ?barplot2 barplot2(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4), plot.ci=TRUE,ci.l=means,ci.u=means+halfSE) Mikhail

[R] Applyin Weights In RCommander

2011-08-12 Thread Simon Kiss
Dear Colleagues, Do any R-plugins handle complex sampling procedures? I know that survey is probably the best one from the command line and the standard linear model can handle it in the RCommander, but I'd like to be able to show students how to apply weights doing simple descriptive

Re: [R] problem in asreml function in wgaim package

2011-08-12 Thread ram basnet
Dear Uwe Ligges,   Thanks for your prompt response. I visited website link that you mentioned. It seems it needs license though it is R package. Am i correct ?   Thanks   Regards,   Ram Kumar Basnet   From: Uwe Ligges lig...@statistik.tu-dortmund.de To: ram basnet basnet...@yahoo.com Cc: R help

Re: [R] Plotting and quantiles

2011-08-12 Thread Daniel Malter
Q1 is very opaque because you are not even saying what kind of plot you want. For a regular scatterplot, you have multiple options. a.) select only the data in the given intervals and plot the data b.) plot the entire data, but restrict the graph region to the intervals you are interested in, or

Re: [R] rollapply.zoo() with na.rm=TRUE

2011-08-12 Thread Gabor Grothendieck
On Fri, Aug 12, 2011 at 11:47 AM, Giles giles.heyw...@cantab.net wrote: Hi. I'm comparing output from rollapply.zoo, as produced by two versions of R and package zoo.  I'm illustrating with an example from a R-help posting 'Zoo - bug ???' dated 2010-07-13. My question is not about the first

Re: [R] problem in asreml function in wgaim package

2011-08-12 Thread Uwe Ligges
On 12.08.2011 19:21, ram basnet wrote: Dear Uwe Ligges, Thanks for your prompt response. I visited website link that you mentioned. It seems it needs license though it is R package. Don't know about ASREML-R - ask the authors. The wgaim package itself is declared to be under license GPL-2.

Re: [R] problem in asreml function in wgaim package

2011-08-12 Thread ram basnet
Dear Uwe Ligges, Thanks for response. I mean this R package is not free package.   Thanks   Ram Kumar Basnet   From: Uwe Ligges lig...@statistik.tu-dortmund.de To: ram basnet basnet...@yahoo.com Cc: R help r-help@r-project.org Sent: Friday, August 12, 2011 7:28 PM Subject: Re: [R] problem in

[R] testEquatingData (part of ltm package) changes order of columns

2011-08-12 Thread Alexander Schwall
Dear R community, I hope someone is out there who has some insights into the ltm package. Specifically, I am seeking help for the testEquatingData function which is part of this package. Here is an example of my data: #install.packages(ltm, dependencies = TRUE) library(ltm) anchor-

Re: [R] sapply to bind columns, with repeat?

2011-08-12 Thread Weidong Gu
Katrina, try this. reorg-function(x){ mat-matrix(x[9:length(x)],ncol=6,byrow=T) rem.col-matrix(rep(x[1:8],nrow(mat)),byrow=T,ncol=8) return(data.frame(cbind(rem.col,mat))) } co-do.call('rbind',apply(coop.dat,1,function(x) reorg(x))) You may need to tweak a bit to fit exactly what you want.

Re: [R] problem in asreml function in wgaim package

2011-08-12 Thread Kevin Wright
You are correct. asreml is a commercial package which requires a license. See the download site for more information. Kevin Wright On Fri, Aug 12, 2011 at 12:52 PM, ram basnet basnet...@yahoo.com wrote: Dear Uwe Ligges, Thanks for response. I mean this R package is not free package.

[R] Any alternatives to draw.colorkey from lattice package?

2011-08-12 Thread Mikhail Titov
Hello! I’d like to have a continuous color bar on my lattice xyplot with colors lets say from topo.colors such that it has ticks labels at few specific points only. Right now I use do.breaks level.colors with somewhat large number of steps. The problem is that color change point doesn’t

Re: [R] Which Durbin-Watson is correct? (weights involved) - using durbinWatsonTest and dwtest (packages car and lmtest)

2011-08-12 Thread Achim Zeileis
On Fri, 12 Aug 2011, Dimitri Liakhovitski wrote: Hello! I have a data frame mysample (sorry for a long way of creating it below - but I need it in this form, and it works). I regress Y onto X1 through X11 - first without weights, then with weights: regtest1-lm(Y~., data=mysample[-13]))

[R] CairoPDF

2011-08-12 Thread ivo welch
Regarding Simon Urbanek's excellent CairoPDF package, I noticed two items: [1] looking at the april 6, 2011 documentation, on page 6, there are some painful non-line breaks. One of them makes it impossible to understand how the process would work. (see my example post earlier on the charter

[R] Getting data from an *.RData file into a data.frame object.

2011-08-12 Thread Ed Heaton
Hi, all. I'm new to R. I've been a SAS programmer for 20 years. I seem to be having trouble with the most basic task - bringing a table in an *.RData file into a data.frame object. Here's how I created the *.RData file. library(RODBC) db - odbcConnect(***) df - sqlQuery( db , select

Re: [R] value.labels

2011-08-12 Thread zcatav
Jim Lemon wrote: Hi Zeki, fgh-read.table(fgh.tab,header=TRUE,sep=\t) fgh$c-add.value.labels(fgh$c,c(alive,dead,zombie)) fgh$c Jim Thanks Jim, This is what i want. Result as follows; test2$c-add.value.labels(test2$c,c(alive,dead,zombie)) test2$c [1] 0 1 1 0 2 0 0 0 0

[R] Automating an R function call

2011-08-12 Thread RobertJK
Any way to run an R function every 5 minutes from the R terminal? Searched around but couldn't find any answers. Thanks!! Robert -- View this message in context: http://r.789695.n4.nabble.com/Automating-an-R-function-call-tp3740070p3740070.html Sent from the R help mailing list archive at

Re: [R] Automating an R function call

2011-08-12 Thread Ken
Hey, Sys.sleep(300) ?Sys.sleep Ken Hutchison On Aug 12, 2554 BE, at 2:03 PM, RobertJK rkind...@gmail.com wrote: Any way to run an R function every 5 minutes from the R terminal? Searched around but couldn't find any answers. Thanks!! Robert -- View this message in context:

Re: [R] Getting data from an *.RData file into a data.frame object.

2011-08-12 Thread Duncan Murdoch
On 12/08/2011 3:12 PM, Ed Heaton wrote: Hi, all. I'm new to R. I've been a SAS programmer for 20 years. I seem to be having trouble with the most basic task - bringing a table in an *.RData file into a data.frame object. Here's how I created the *.RData file. library(RODBC) db-

[R] Grid unit width and font face

2011-08-12 Thread Sébastien Bihorel
Dear R-users, When one defines a grid unit object using the 'strwidth' dimension, it seems that the default plain font is assumed as the following example illustrates. Is there a way to either make use of a font option when creating a unit object or to know the factor that exists between the

Re: [R] Automating an R function call

2011-08-12 Thread Duncan Murdoch
On 12/08/2011 2:03 PM, RobertJK wrote: Any way to run an R function every 5 minutes from the R terminal? Searched around but couldn't find any answers. Thanks!! Yes, but not in the background: repeat { f() Sys.sleep(300) } If you want it run in the background, get your OS to run R to do

Re: [R] Getting data from an *.RData file into a data.frame object.

2011-08-12 Thread peter dalgaard
On Aug 12, 2011, at 21:12 , Ed Heaton wrote: Hi, all. I'm new to R. I've been a SAS programmer for 20 years. I seem to be having trouble with the most basic task - bringing a table in an *.RData file into a data.frame object. Here's how I created the *.RData file. library(RODBC)

Re: [R] Automating an R function call

2011-08-12 Thread Greg Snow
Do you want to be doing other things with the R terminal in the meantime? Are you OK with the terminal being locked up between runs and just want to see the output updated? Is it OK to have a new instance of R run the function? If the last one is doable then you can have your OS scheduled to

Re: [R] Automating an R function call

2011-08-12 Thread peter dalgaard
On Aug 12, 2011, at 21:26 , Duncan Murdoch wrote: On 12/08/2011 2:03 PM, RobertJK wrote: Any way to run an R function every 5 minutes from the R terminal? Searched around but couldn't find any answers. Thanks!! Yes, but not in the background: repeat { f() Sys.sleep(300) } If you

Re: [R] recode Variable in dependence of values of two other variables

2011-08-12 Thread Dennis Murphy
Hi: Here are several equivalent ways to produce your desired output: # Base package: transform() df - transform(df, mean = ave(x, id, FUN = mean)) # plyr package library('plyr') ddply(df, .(id), transform, mean = mean(x)) # data.table package library('data.table') dt - data.table(df, key =

Re: [R] Which Durbin-Watson is correct? (weights involved) - using durbinWatsonTest and dwtest (packages car and lmtest)

2011-08-12 Thread Dimitri Liakhovitski
Thank you, Achim. So, then a follow up question to the community: is there a package out there that allows one to calculate a correct DW for a regression with weights? Dimitri On Fri, Aug 12, 2011 at 2:42 PM, Achim Zeileis achim.zeil...@uibk.ac.at wrote: On Fri, 12 Aug 2011, Dimitri Liakhovitski

Re: [R] Automating an R function call

2011-08-12 Thread Ken Hutchison
Hey, Also, if your function varies in time (less than 5 minutes) then you could use total.time.difference=system.time(some.function)[1)] # (for user time) and you could plug this into your Sys.sleep() (which accepts decimal seconds) if you can #accept an error on the order of hundredths of

[R] deSolve output

2011-08-12 Thread Sébastien Bihorel
Hi, Try with the following ODE function. This should give you an extra column with the derivative of G in your THAAC matrix. degradation = function (t, state, parameters) {  with(as.list(c(state, parameters)),    {dG = (-a*(t+i)^b)*(G)    list(c(dG),dG=dG)    }) } Any additional variables that

Re: [R] Grid unit width and font face

2011-08-12 Thread Prof Brian Ripley
I think you are doing this in the wrong order. You need to set the gpar on the viewport, then compute the grid.rect. grid.rect(width=unit(1,'strwidth','Some text'),draw=T, gp=gpar(font=2)) grid.text('Some text',y=0.4,gp=gpar(font=2),draw=T) is one way to do it: pushing a viewport is

Re: [R] sapply to bind columns, with repeat?

2011-08-12 Thread Weidong Gu
On Fri, Aug 12, 2011 at 5:08 PM, Katrina Bennett kebenn...@alaska.edu wrote: Hi Weidong Gu, This works! For my clarity, and so I can repeat this process if need be: The 'mat' generates a matrix using whatever is supplied to x (i.e. coop.dat) using the columns from position 9:length(x) of 6

Re: [R] Sample size AUC for ROC curves

2011-08-12 Thread David Winsemius
On Aug 11, 2011, at 5:50 AM, Karl Knoblick wrote: Thanks. Actually I thought of something like Hanley JA, McNeil BJ. A method of comparing the areas under receiver operating characteristic curves derived from the same cases. Radiology. 1983; 148: 839–843.

[R] define variables from a matrix

2011-08-12 Thread gallon li
I have a following matrix and wish to define a variable based the variable A=matrix(0,5,5) A[1,]=c(30,20,100,120,90) A[2,]=c(40,30,20,50,100) A[3,]=c(50,50,40,30,30) A[4,]=c(30,20,40,50,50) A[5,]=c(30,50,NA,NA,100) A [,1] [,2] [,3] [,4] [,5] [1,] 30 20 100 120 90 [2,] 40 30