[R] Statistical courses

2008-10-15 Thread timpanister
Hi, Can anyone suggest some short term statistical courses using R that one could take? Name or Links will be much appreciated. many thanks, j [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] Using source()

2008-10-15 Thread Prof Brian Ripley
On Thu, 16 Oct 2008, Michael Just wrote: Hello, I have never used source and I am a R beginner. Not a 'beginner' R-help poster, though. (32 posts this month so far under this name.) If I have text file that contains 1,000's of lines of code. Can I use source to bring this code into R a

Re: [R] qt with df<1 (repost)

2008-10-15 Thread Prof Brian Ripley
On Sun, 12 Oct 2008, Peter Dalgaard wrote: Prof Brian Ripley wrote: Please do RTFM, for the help says df: degrees of freedom (> 0, maybe non-integer). 'df = Inf' is allowed. For 'qt' only values of at least one are currently supported. On Sun, 12 Oct 2008, Enrico R

Re: [R] how to count unique observations by variables

2008-10-15 Thread ronggui
How about this: > df1=data.frame(v1=c(1,1,2,3,2,4,1)) > df1$v2 <- ave(df1$v1,df1$v1,FUN=length) > df1 v1 v2 1 1 3 2 1 3 3 2 2 4 3 1 5 2 2 6 4 1 7 1 3 On Thu, Oct 16, 2008 at 1:27 PM, Lijiang Guo <[EMAIL PROTECTED]> wrote: > Dear R-helpers, > > I have a data frame with 3 variables

[R] Using source()

2008-10-15 Thread Michael Just
Hello, I have never used source and I am a R beginner. If I have text file that contains 1,000's of lines of code. Can I use source to bring this code into R and execute the code? Does it run the code one line at a time? Is there a best way to setup source() for maximum effieciency? After reading ?

Re: [R] how to count unique observations by variables

2008-10-15 Thread David Winsemius
On Oct 16, 2008, at 1:27 AM, Lijiang Guo wrote: Dear R-helpers, I have a data frame with 3 variables, each record is a unique combination of the three variables. I would like to count the number of unique values of v3 in each v1, and save it as a new variable v4 in the same data frame. e.

Re: [R] Rscript -e, Sweave and tempdir()

2008-10-15 Thread Prof Brian Ripley
My first thought was that this is R < 2.7.2 and you have encountered (from the CHANGES file) o Rscript -e (and Rterm -e) failed on Vista because the MSVCRT function 'tmpfile' is broken on that platform. But that couldn't possibly be the case, as the posting guide required you to upd

[R] how to count unique observations by variables

2008-10-15 Thread Lijiang Guo
Dear R-helpers, I have a data frame with 3 variables, each record is a unique combination of the three variables. I would like to count the number of unique values of v3 in each v1, and save it as a new variable v4 in the same data frame. e.g. df1 [v1] [v2] [v3] [1,] "a" "C" "1" [2,] "b" "

[R] Rscript -e, Sweave and tempdir()

2008-10-15 Thread Paul.Rustomji
Hello R-Help I have a question about the "behind the scenes" behaviour of the Rscript -e command and particularly its interaction with Sweave and tempdir(). We are trying to deploy R as a web service to do water quality analyses and have been writing software to call Sweave via Rscript eg: cm

Re: [R] plot - central limit theorem

2008-10-15 Thread Matthias Kohl
Hi Jörg, our package distrTeach has functions to visualize the central limit theorem and the law of large numbers for "arbitrary" univariate distributions; e.g., library(distrTeach) D <- sin(Norm()) + Pois() plot(D) illustrateCLT(D, len = 10) illustrateLLN(D, m = 10) Best Matthias Jörg Groß

Re: [R] plot - central limit theorem

2008-10-15 Thread Yihui Xie
Thanks, Roger, your demo is interesting. I'm thinking about improving it later. I've also made a demo for the CLT in my package 'animation', in which there's also normality testing for the sample means, because I don't think "bell-shaped" alone means normality - so I performed the Shapiro-Wilk tes

Re: [R] Two last questions: about output

2008-10-15 Thread Ted Byers
Thanks Gabor, To be clear, would something like testframe$est[[i]] <- fp$estimate be valid within my loop, as in (assuming I created testframe before the loop): for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]), header = FALSE, na.strings=""); y = x[,1]; fp = fitdistr(y,"expo

Re: [R] Double Bootstrap

2008-10-15 Thread Prof Brian Ripley
On Wed, 15 Oct 2008, Mathew Rosales wrote: Hi All, Is there a package in R that does double bootstrap? Yes, package 'boot'. It's support software for a book, and you will need to look in the book to see how to do it. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of App

Re: [R] trouble with combining png and pdf

2008-10-15 Thread Yihui Xie
I'd like to suggest you "combine" them in R instead of using other software. For example, you can use low-level plot commands to add the points to the image plot. If you insist on combining them together, you may use the utility "composite" in ImageMagick, but I don't recommend you to combine a pd

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Ted Byers
Thank you Prof. Ripley. I appreciate this. Have a good day. Ted On Thu, Oct 16, 2008 at 12:20 AM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > On Wed, 15 Oct 2008, Ted Byers wrote: > >> Thanks Jim, >> >> I hadn't seen the distinction between the commandline in RGui and what >> happens within

Re: [R] CRAN Package Check Results for Package caMassClass : Error

2008-10-15 Thread Prof Brian Ripley
On Wed, 15 Oct 2008, Minwook Kim wrote: Hello, If package check showed the Error, How can I use that? I want to use caMassClass in Mac. By compiling from the sources, but please ask about Mac packages on R-sig-mac. You need to click on ERROR to see what the problem was: Packages r

Re: [R] Can R scripts executed in batch mode take a commandline argument?

2008-10-15 Thread Prof Brian Ripley
On Wed, 15 Oct 2008, cls59 wrote: On Unix/Linux platforms, you can use the included Rscript utility by adding the following shebang at the top of your program. Command line arguments can then be retrieved using the commandArgs function: #!/usr/bin/Rscript args <- commandArgs(trailingOnly = TR

[R] Double Bootstrap

2008-10-15 Thread Mathew Rosales
Hi All, Is there a package in R that does double bootstrap? Thanks, Matt __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commente

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Prof Brian Ripley
On Wed, 15 Oct 2008, Ted Byers wrote: Thanks Jim, I hadn't seen the distinction between the commandline in RGui and what happens within my code. I have, however seen other differences I don't understand. For example, looking at the documentation for RScript, I see: Rscript [options] [-e expr

Re: [R] Two last questions: about output

2008-10-15 Thread Gabor Grothendieck
testframe$newvar <- ...whatever... (or see ?transform for another way) adds a new column to the data frame. The table does not have to pre-exist in your MySQL database and you don't need a create statement; however, if the table does pre-exist the columns of your data frame and those of the datab

Re: [R] Two last questions: about output

2008-10-15 Thread Ted Byers
Thanks Gabor, I get how to make a frame using existing vectors. In my example, the following puts my first three columns into a frame (and displays it: > testframe <- data.frame(mid=V1,year=V2,week=V3) > testframe mid year week 1 251 2008 18 2 251 2008 19 3 251 2008 20 4 251 2008

Re: [R] "Heuristic optimisation"?

2008-10-15 Thread paulandpen
Ajay, Bayesm deals with this very issue in choice modelling (a form of econometric modelling as outlined in the article). I think those guys (the developers of Bayesm) and the apprach they recommend for navigating the likelihood function through a bayesian approachs makes a lot of sense to me,

[R] CRAN Package Check Results for Package caMassClass : Error

2008-10-15 Thread Minwook Kim
Hello, If package check showed the Error, How can I use that? I want to use caMassClass in Mac. CRAN Package Check Results for Package caMassClass Last updated on 2008-10-15 23:56:28. Flavor Version Tinstall Tcheck Ttotal Status Flags r-devel-linux-ix86 1.6 13.53 439.10 452.63 N

Re: [R] a really simple question on polynomial multiplication

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 2:27 PM, Moshe Olshansky wrote: Hi Rolf, Thank you for making me aware of the existence of PolynomF package. By the way, your solution needs a small modification: a <- polynom(c(-3,1)) and not polynom(-3,1) and similar for b. Indeed; I typed the code into the email separat

Re: [R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 2:29 PM, Guillaume Filteau wrote: Hello all, When I create a matrix, is there a way to make it start at [0,0], instead of [1,1]? That way, a 2x2 matrix would go from [0,0] to [1,1], instead of [1,1] to [2,2]. First, see fortune(36). Then, if you ***MUST***, install packag

Re: [R] Two last questions: about output

2008-10-15 Thread Gabor Grothendieck
Put the data in an R data frame and use dbWriteTable() to write it to your MySQL database directly. On Wed, Oct 15, 2008 at 9:34 PM, Ted Byers <[EMAIL PROTECTED]> wrote: > > Here is my little scriptlet: > > optdata = > read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", > hea

Re: [R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Gabor Grothendieck
If you are willing to use character instead of numeric you can: > xx <- matrix(1:4, 2, 2, dimnames = list(as.character(0:1), as.character(0:1))) > xx 0 1 0 1 3 1 2 4 > xx["0", "1"] [1] 3 On Wed, Oct 15, 2008 at 9:29 PM, Guillaume Filteau <[EMAIL PROTECTED]> wrote: > Hello all, > > When I creat

Re: [R] Can R scripts executed in batch mode take a commandline argument?

2008-10-15 Thread cls59
On Unix/Linux platforms, you can use the included Rscript utility by adding the following shebang at the top of your program. Command line arguments can then be retrieved using the commandArgs function: #!/usr/bin/Rscript args <- commandArgs(trailingOnly = TRUE) args is now a character vector c

[R] Matrix starting at [0,0] instead of [1,1]?

2008-10-15 Thread Guillaume Filteau
Hello all, When I create a matrix, is there a way to make it start at [0,0], instead of [1,1]? That way, a 2x2 matrix would go from [0,0] to [1,1], instead of [1,1] to [2,2]. Best, Guillaume __ R-help@r-project.org mailing list https://stat.ethz.

[R] Two last questions: about output

2008-10-15 Thread Ted Byers
Here is my little scriptlet: optdata = read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", header = FALSE, na.strings="") attach(optdata) library(MASS) setwd("K:\\MerchantData\\RiskModel\\AutomatedRiskModel") for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]),

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Ted Byers
Thanks Jim, I hadn't seen the distinction between the commandline in RGui and what happens within my code. I have, however seen other differences I don't understand. For example, looking at the documentation for RScript, I see: Rscript [options] [-e expression] file [args] And the example: Rs

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread jim holtman
You have to explicitly 'print' the value of x in the loop:print(x) 'x' by itself is just it value. At the command line, typing an objects name is equivalent to printing that object, but it only happens at the command line. If you want a value printed, the 'print' it. Also works at the comma

Re: [R] help with a for loop

2008-10-15 Thread jim holtman
I am not sure what you mean by "p is not updated". I took the basic outline you have and as you can see, p has the correct value after the loop. > p<-0.1 > n<-10 > result<-list() > while (p<=1) { + for (i in 1:n) { + result[[i]]<-p + p<-p+0.1 + print(p) + } + } [1]

Re: [R] Fw: Logistic regresion - Interpreting (SENS) and (SPEC)

2008-10-15 Thread Gad Abraham
Frank E Harrell Jr wrote: Gad Abraham wrote: This approach leaves much to be desired. I hope that its practitioners start gauging it by the mean squared error of predicted probabilities. Is the logic here is that low MSE of predicted probabilities equals a better calibrated model? What abou

Re: [R] R: "in-place" appending to a matrix.

2008-10-15 Thread Gabor Grothendieck
Create an empty matrix first and then fill it in. That will avoid the overhead in repeatedly expanding it. If you don't know how many rows then make it 1000 rows and remove the unused ones once finished. On Wed, Oct 15, 2008 at 4:05 PM, culpritNr1 <[EMAIL PROTECTED]> wrote: > > Hello fellow R s

Re: [R] "Heuristic optimisation"?

2008-10-15 Thread Ben Bolker
Ajay Shah mayin.org> writes: > > I wondered was people on this list felt about this article: > http://www.voxeu.org/index.php?q=node/2363 > which talks about the problems of obtaining sound answers in numerical > optimisation in settings such as MLE or NLS. It seems perfectly reasonable (it

Re: [R] problem using R

2008-10-15 Thread Richard Rowe
Dennis Lee Bieber wrote: On Tue, 14 Oct 2008 09:10:14 -0400, "Daniel Malter" <[EMAIL PROTECTED]> declaimed the following in gmane.comp.lang.r.general: Other than that I agree with Duncan, your teacher is being paid for helping you with these very basic problems. "Me three"...

Re: [R] Parameter estimates from an ANCOVA

2008-10-15 Thread John Fox
Dear J., Perhaps the following will clarify what you got: (1) For those unfamiliar with it, contr.Sum() is like contr.sum(), except for (in my opinion) printing more informative coefficient labels. There is no contr.Poly(), but since you didn't use it, there was no error. (2) Here's what I got w

Re: [R] strsplit and regex

2008-10-15 Thread Redding, Matthew
Hi All, Thanks for all these great efficient solutions. Another one in the mix that Phil S. sent on to me: sapply(strsplit(tst,":"),function(x)x[2]) Matt >-Original Message- >From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] >Sent: Thursday, 16 October 2008 8:38 AM >To: Redding, Matt

Re: [R] combining same-day lab measurements with 'apply'

2008-10-15 Thread hadley wickham
Hi Dylan, You might want to have a look at the plyr package which is designed to make these sorts of tasks easier - http://had.co.nz/plyr. The site includes a ~20 page introductory pdf. Hadley On Wed, Oct 15, 2008 at 3:45 PM, dylan boyd <[EMAIL PROTECTED]> wrote: > Another request for help imp

Re: [R] dynlm and lm: should they give same estimates?

2008-10-15 Thread Achim Zeileis
On Wed, 15 Oct 2008, Werner Wernersen wrote: Hi, I was wondering why the results from lm and dynlm are not the same for what I think is the same model. ...because it's not the same model :-) I haven't looked at this in detail, but: set.seed(123456) e1 <- rnorm(100) e2 <- rnorm(100) y1 <-

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 11:07 AM, Prof Brian Ripley wrote: [[ ]] works on vectors! So it does. My bad. letters[[3]] [1] "c" See help("[["). But strictly V4 is a factor and hence not a vector: [[ ]] also works on factors. Yes. I had forgotten that not everyone sets options (stringsAsF

Re: [R] strsplit and regex

2008-10-15 Thread Gabor Grothendieck
Here are several solutions: #1 # replace first three and last 3 characters with nothing x <- c("23:10:34", "01:02:03") gsub("^...|...$", "", x) #2 # backref = -1 says extract the portion in parens # it would have returned a list so we use simplify = c library(gsubfn) strapply(x, ":(..):", backref

Re: [R] strsplit and regex

2008-10-15 Thread Henrique Dallazuanna
Try this: format(strptime(tst, "%H:%M:%S"), "%M") On Wed, Oct 15, 2008 at 6:54 PM, Redding, Matthew < [EMAIL PROTECTED]> wrote: > Hi All, > > Is there a means to extract the "10" from "23:10:34" in one pass using > strsplit (or something else)? > tst <- "23:10:34" > > For example my attempt > s

Re: [R] a really simple question on polynomial multiplication

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 10:44 AM, Erin Hodgess wrote: Dear R people: Is there a way to perform simple polynomial multiplication; that is, something like (x - 3) * (x + 3) = x^2 - 9, please? I looked in poly and polyroot and expression. There used to be a package that had this, maybe? The Polynom

Re: [R] strsplit and regex

2008-10-15 Thread Prof Brian Ripley
It's no harder: use sub() which is vectorized. You've not actually defined the pattern, but here is my guess at your intentions: x <- c("23:10:34", "23:20:30") sub("([0-9][0-9]:)([0-9][0-9])(:[0-9][0-9])", "\\2", x) Another interpetation would be sub("([^:]*:)([^:]*)(:[^:]*)", "\\2", x) for

Re: [R] a really simple question on polynomial multiplication

2008-10-15 Thread Moshe Olshansky
One way is to use convolution (?convolve): If A(x) = a_p*x^p + ... + a_1*x + a_0 and B(x) = b_q*x^q + ... + b_1*x + b_0 and if C(x) = A(x)*B(x) = c_(p+q)*x^(p+q) + ... + c_0 then c = convolve(a,rev(b),type="open") where c is the vector (c_(p+q),...,c_0), a is (a_p,...,a_0) and b is (b_q,...,b_0)

Re: [R] strsplit and regex

2008-10-15 Thread Erik Iverson
Matthew - Redding, Matthew wrote: Hi All, Is there a means to extract the "10" from "23:10:34" in one pass using strsplit (or something else)? tst <- "23:10:34" For example my attempt strsplit(as.character(tst),"^[0-9]*:") gives [[1]] [1] "" "" "34" Why not simply, strsplit(tst, ":")

Re: [R] strsplit and regex

2008-10-15 Thread Redding, Matthew
Hi All, Just to make that question a bit harder - how do I apply that string extraction to vector of these time strings? Thanks, Matt Redding >-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Redding, Matthew >Sent: Thursday, 16 October 2008 7:54

[R] dynlm and lm: should they give same estimates?

2008-10-15 Thread Werner Wernersen
Hi, I was wondering why the results from lm and dynlm are not the same for what I think is the same model. I have just modified example 4.2 from the Pfaff book, please see below for the code and results. Can anyone tell my what I am doing wrongly? Many thanks, Werner set.seed(123456) e1 <-

Re: [R] Confused with default device setup

2008-10-15 Thread Prof Brian Ripley
This was also posted on R-sig-mac, and I've answered it there. Please don't cross-post. On Wed, 15 Oct 2008, Gang Chen wrote: When invoking dev.new() on my Mac OS X 10.4.11, I get an X11 window instead of quartz which I feel more desirable. So I'd like to set the default device to quartz. Howe

Re: [R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Peter Dalgaard
Joe Kaser wrote: Thanks for the help. ifelse does the job. Could you elaborate, or give an example of the "awkward" things ifelse might do to classed objects? It strips the class. One thing that usually gets me is this: > dd <- as.Date(c("2008-1-2","2007-3-21")) > ifelse(dd>as.Date("2008-1-

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Prof Brian Ripley
[[ ]] works on vectors! letters[[3]] [1] "c" See help("[["). But strictly V4 is a factor and hence not a vector: [[ ]] also works on factors. On Thu, 16 Oct 2008, Rolf Turner wrote: On 16/10/2008, at 10:03 AM, jim holtman wrote: try putting as.character in the call: x = read.csv(as.c

Re: [R] Defining a "list"

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 10:47 AM, Wacek Kusnierczyk wrote: Rolf Turner wrote: On 16/10/2008, at 12:28 AM, Henrique Dallazuanna wrote: Try this: lapply(1:n, rnorm) That has nothing to do with what the inquirer *asked*. probably because it's not what the inquirer knew he *should* have asked.

Re: [R] Getting frustrated with RMySQL

2008-10-15 Thread repkakala Gazeta.pl
Neat? It mihgt be very usefull, but it's rather a dirty hack in a dirty language than a 'neat' solution. \misiek > That is neat Gabor. Thanks, Ted > Gabor Grothendieck wrote: > > The gsubfn package can do quasi perl-style interpolation by > prefacing any function call with fn$. > > library(gs

Re: [R] a really simple question on polynomial multiplication

2008-10-15 Thread Jorge Ivan Velez
Dear Erin, Yes. Take a look at page 13 in [1]. HTH, Jorge [1] http://cran.r-project.org/web/packages/Ryacas/vignettes/Ryacas.pdf On Wed, Oct 15, 2008 at 5:44 PM, Erin Hodgess <[EMAIL PROTECTED]>wrote: > Dear R people: > > Is there a way to perform simple polynomial multiplication; that is,

Re: [R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Joe Kaser
Ah! Thanks. ifelse() appears to do the job. note: subtracting 12 from chron rather than noon doesn't seem to work. I think (but am not totally sure) chron interprets 12 as fraction of a day - i.e. 12/1 days... On Wed, Oct 15, 2008 at 1:33 PM, Greg Snow <[EMAIL PROTECTED]> wrote: > The if state

[R] strsplit and regex

2008-10-15 Thread Redding, Matthew
Hi All, Is there a means to extract the "10" from "23:10:34" in one pass using strsplit (or something else)? tst <- "23:10:34" For example my attempt strsplit(as.character(tst),"^[0-9]*:") gives [[1]] [1] "" "" "34" Obviously it is matching the first two instances of [0-9]. Note that there

Re: [R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Joe Kaser
Thanks for the help. ifelse does the job. Could you elaborate, or give an example of the "awkward" things ifelse might do to classed objects? On Wed, Oct 15, 2008 at 1:38 PM, Peter Dalgaard <[EMAIL PROTECTED]>wrote: > Joe Kaser wrote: > >> Hello, >> >> I've been learning R functions recently and

[R] a really simple question on polynomial multiplication

2008-10-15 Thread Erin Hodgess
Dear R people: Is there a way to perform simple polynomial multiplication; that is, something like (x - 3) * (x + 3) = x^2 - 9, please? I looked in poly and polyroot and expression. There used to be a package that had this, maybe? thanks, Erin -- Erin Hodgess Associate Professor Department o

Re: [R] Defining a "list"

2008-10-15 Thread Wacek Kusnierczyk
Rolf Turner wrote: > > On 16/10/2008, at 12:28 AM, Henrique Dallazuanna wrote: > >> Try this: >> >> lapply(1:n, rnorm) > > That has nothing to do with what the inquirer *asked*. > probably because it's not what the inquirer knew he *should* have asked. it does solve the task he used as an example i

[R] Parameter estimates from an ANCOVA

2008-10-15 Thread jgar
Hi all, This is probably going to come off as unnecessary (and show my ignorance) but I am trying to understand the parameter estimates I am getting from R when doing an ANCOVA. Basically, I am accustomed to the estimate for the categorical variable being equivalent to the respective cell means

[R] stablefit can fit the parameters of a truncated normal distribution?

2008-10-15 Thread drbn
I'm using stableFit from the package fBasics to estimate the parameters of a truncated normal distribution (I'm interested in the parameters of the underlying normal distribution). It is correct to generalize this truncated normal distribution as a stable distribution ? Thanks David -- View thi

[R] R: "in-place" appending to a matrix.

2008-10-15 Thread culpritNr1
Hello fellow R sufferers, Is there a way to perform an appending operation in place? Currently, the way my pseudo-code goes is like this for (i in 1:1000) { if (some condition) { newRow <- myFunction(myArguments) X <- rbind(X, newRow) # <- this is the bottleneck!! }

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Ted Byers
Actually, I'd tried single brackets first. Here is what I got: > for (i in 1:length(V4) ) { x = read.csv(V4[i], header = FALSE, > na.strings="");x } Error in read.table(file = file, header = header, sep = sep, quote = quote, : 'file' must be a character string or connection > the advice to

[R] Confused with default device setup

2008-10-15 Thread Gang Chen
When invoking dev.new() on my Mac OS X 10.4.11, I get an X11 window instead of quartz which I feel more desirable. So I'd like to set the default device to quartz. However I'm confused because of the following: > Sys.getenv("R_DEFAULT_DEVICE") R_DEFAULT_DEVICE "quartz" > getOption("devi

Re: [R] Defining a "list"

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 12:28 AM, Henrique Dallazuanna wrote: Try this: lapply(1:n, rnorm) That has nothing to do with what the inquirer *asked*. On Wed, Oct 15, 2008 at 8:19 AM, Megh Dal <[EMAIL PROTECTED]> wrote: Can anyone please tell me how to define a "list". Suppose I want to define

[R] reducing memory usage WAS: Problems with R memory usage on Linux

2008-10-15 Thread B. Bogart
Hello, I have read the R memory pages. I realized after my post that I would not have enough memory to accomplish this task. The command I'm using to convert the list into a data-frame is as such: som <- do.call("rbind", somlist) Where som is the dataframe resulting from combining all the data

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread Rolf Turner
On 16/10/2008, at 10:03 AM, jim holtman wrote: try putting as.character in the call: x = read.csv(as.character(V4[[i]]), header = FALSE No. This won't help. V4 is a column of the data frame optdata, and hence is a vector. Not a list! Use single brackets --- V4[i] --- and all will be well

Re: [R] Argh! Trouble using string data read from a file

2008-10-15 Thread jim holtman
try putting as.character in the call: x = read.csv(as.character(V4[[i]]), header = FALSE On Wed, Oct 15, 2008 at 4:46 PM, Ted Byers <[EMAIL PROTECTED]> wrote: > > Here is what I tried: > > optdata = > read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", > header = FALSE, na.s

[R] Argh! Trouble using string data read from a file

2008-10-15 Thread Ted Byers
Here is what I tried: optdata = read.csv("K:\\MerchantData\\RiskModel\\AutomatedRiskModel\\soptions.dat", header = FALSE, na.strings="") optdata attach(optdata) for (i in 1:length(V4) ) { x = read.csv(V4[[i]], header = FALSE, na.strings="");x } And here is the outcome (just a few of the 60 reco

Re: [R] Forecasting using ARIMAX

2008-10-15 Thread Rob Hyndman
Hi Siang Li. It would help if you explained what packages you are using. auto.arima() is in the forecast package and arimax appears to be from the TSA package. Using auto.arima() to select the orders is inappropriate because you are ignoring the regressors. auto.arima() does not currently handle

[R] combining same-day lab measurements with 'apply'

2008-10-15 Thread dylan boyd
Another request for help implementing the 'apply' functions to avoid a loop structure... I am working with a data set that includes lab measurements taken at different dates for the subjects, with some subjects having more results than others. I would like to average lab results for each subject

Re: [R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Peter Dalgaard
Joe Kaser wrote: Hello, I've been learning R functions recently and I've come across a problem that perhaps someone could help me with. # I have a a chron() object of times hours=chron(time=c("01:00:00","18:00:00","13:00:00","10:00:00")) # I would like to subtract 12 hours from each time el

Re: [R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Greg Snow
The if statement is for program flow control (do this bunch of code if this condition is true, else do this), the vectorized version is the ifelse function, that is the one that you want to use. Also note (this is for times in general, not sure about chron specifically) subtracting noon from th

[R] Condition warning: has length > 1 and only the first element will be used

2008-10-15 Thread Joe Kaser
Hello, I've been learning R functions recently and I've come across a problem that perhaps someone could help me with. # I have a a chron() object of times > hours=chron(time=c("01:00:00","18:00:00","13:00:00","10:00:00")) # I would like to subtract 12 hours from each time element, so I created

Re: [R] plot - central limit theorem

2008-10-15 Thread roger koenker
Galton's 19th century mechanical version of this is the quincunx. I have a (very primitive) version of this for R at: http://www.econ.uiuc.edu/~roger/courses/476/routines/quincunx.R url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Depart

Re: [R] plot - central limit theorem

2008-10-15 Thread Rubén Roa-Ureta
Jörg Groß wrote: Hi, Is there a way to simulate a population with R and pull out m samples, each with n values for calculating m means? I need that kind of data to plot a graphic, demonstrating the central limit theorem and I don't know how to begin. So, perhaps someone can give me some t

Re: [R] Removing characters and periods from character strings

2008-10-15 Thread Greg Snow
To remove all numbers and periods at the end do: > vars <- sub("[0-9.]+$", "", pick ) If there are other periods that this does not remove (not at the end) then you can do a second pass: > vars <- sub("\\.", "", vars) Part of the reason that your code for the period does not work is that an u

Re: [R] dbAppy questions/clarifications

2008-10-15 Thread Rolf Turner
I can't help with your inquiry generally, but I can address the issue of ``optional braces''. On 16/10/2008, at 8:34 AM, Ted Byers wrote: I take it FUN = function(x, grp) quantile(x$DATA, names=FALSE) is the function definition for a function called FUN. I would guess, then, tha

Re: [R] Removing characters and periods from character strings

2008-10-15 Thread Henrique Dallazuanna
Try this; gsub("\\.|[0-9]", "", pick) On Wed, Oct 15, 2008 at 4:42 PM, John Poulsen <[EMAIL PROTECTED]> wrote: > Hello R-users, > > I have code that gives me the important variables from an analysis. I need > to input these variables into a different analysis. To do this, I need to > modify th

Re: [R] Removing characters and periods from character strings

2008-10-15 Thread Prof Brian Ripley
A case for [g]sub: gsub(".", "", sub("[0-9]*$", "", pick), fixed = TRUE) On Wed, 15 Oct 2008, John Poulsen wrote: Hello R-users, I have code that gives me the important variables from an analysis. I need to input these variables into a different analysis. To do this, I need to modify them

Re: [R] plot - central limit theorem

2008-10-15 Thread Tobias Verbeke
Hi Joerg, Is there a way to simulate a population with R and pull out m samples, each with n values for calculating m means? I need that kind of data to plot a graphic, demonstrating the central limit theorem and I don't know how to begin. So, perhaps someone can give me some tips and hints

[R] help with a for loop

2008-10-15 Thread Quan Li
Hi all, I am running OLS models with a power parameter: y=a+bx^p, and I want to iterate through p with a set increment. The function I constructed is something like below: test<-function(data, model,...){ f<-formula(model) #model="y~I(x^p)" p<-0.1 n<-10 result<-list() while (p<=1) { for (i in 1

Re: [R] plot - central limit theorem

2008-10-15 Thread Duncan Murdoch
On 10/15/2008 3:48 PM, Jörg Groß wrote: Hi, Is there a way to simulate a population with R and pull out m samples, each with n values for calculating m means? I need that kind of data to plot a graphic, demonstrating the central limit theorem and I don't know how to begin. The easiest

[R] Removing characters and periods from character strings

2008-10-15 Thread John Poulsen
Hello R-users, I have code that gives me the important variables from an analysis. I need to input these variables into a different analysis. To do this, I need to modify them slightly... 1) remove all numbers at the end of the variables, 2) remove all periods. I tried to do it with the aw

Re: [R] plot - central limit theorem

2008-10-15 Thread Greg Snow
Look at the clt.examp function in the TeachingDemos package, it generates samples from normal, uniform, gamma (default exponential), and beta (default U-shaped) distributions and plots histograms of the means along with a reference line of a normal distribution with the same mean and sd. The de

[R] plot - central limit theorem

2008-10-15 Thread Jörg Groß
Hi, Is there a way to simulate a population with R and pull out m samples, each with n values for calculating m means? I need that kind of data to plot a graphic, demonstrating the central limit theorem and I don't know how to begin. So, perhaps someone can give me some tips and hints ho

[R] Can R scripts executed in batch mode take a commandline argument?

2008-10-15 Thread Ted Byers
I have examined the documentation for batch mode use of R: R CMD BATCH [options] infile [outfile] The documentation for this seems rather spartan. Running "R CMD BATCH --help" gives me info on only two options: one for getting help and the other to get the version. I see, further on, that th

[R] dbAppy questions/clarifications

2008-10-15 Thread Ted Byers
In the example in the documentation, I see: rs <- dbSendQuery(con, "select Agent, ip_addr, DATA from pseudo_data order by Agent") out <- dbApply(rs, INDEX = "Agent", FUN = function(x, grp) quantile(x$DATA, names=FALSE)) Maybe I am a bit thick, but it took me a while, and a

Re: [R] Problems with R memory usage on Linux

2008-10-15 Thread Prof Brian Ripley
Or ?"Memory-limits" (and the posting guide of course). On Wed, 15 Oct 2008, Prof Brian Ripley wrote: See ?"Memory-size" On Wed, 15 Oct 2008, B. Bogart wrote: Hello all, I'm working with a large data-set, and upgraded my RAM to 4GB to help with the mem use. I've got a 32bit kernel with 64GB

Re: [R] R/Parallel

2008-10-15 Thread Markus Schmidberger
Hi, have a look to Dirks tutorial at the UseR2008. This should be a good starting point: http://www.statistik.uni-dortmund.de/useR-2008/tutorials/eddelbuettel.html Markus Rajasekaramya wrote: > Hi there, > > I am looking for R/parallel package or some other package that would speed > up the an

[R] integrate problem

2008-10-15 Thread Wade Winterhalter
i'm in the process of switch from Maple to R and am trying to code the following function: w(d)=\int -Inf_Inf A(x) |int 0_(t(d)-x) Fy dydx can some one point me in the right direction? i don't seem to be able to figure it out on my own. Dr. Wade Winterhalter University of Central Florida D

[R] R/Parallel

2008-10-15 Thread Rajasekaramya
Hi there, I am looking for R/parallel package or some other package that would speed up the analysis.I am working on computatioanly intensive data so any suggestions would be really helpful. Kindly let me know if any -- View this message in context: http://www.nabble.com/R-Parallel-tp1425p1

Re: [R] LME gives estimates with a random factor that has one 1datapoint per group

2008-10-15 Thread Bert Gunter
Surely you jest! You need to consult your local statistician. -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of mirre simons Sent: Wednesday, October 15, 2008 2:08 AM To: r-help@r-project.org Subject: [R] LME gives estimates with a random fac

Re: [R] Standard deviation for rows

2008-10-15 Thread Alex99
Thanks for the reply, that's exactly what I wanted. I also figured that the function rowSds() does exist. I just needed to load the generfilter package. Thanks again. Nutter, Benjamin wrote: > > ?apply > > e.g. apply(matrix,1,sd) > > -Original Message- > From: [EMAIL PROTECTED] [ma

Re: [R] Standard deviation for rows

2008-10-15 Thread Greg Snow
> apply( mymatrix, 1, sd ) Will give the row standard deviations of a matrix or matrix like data frame. There are also some functions in add-on packages that do row sd's or var's. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 >

Re: [R] Problems with R memory usage on Linux

2008-10-15 Thread repkakala Gazeta.pl
Doen't work. \misiek Prof Brian Ripley wrote: > See ?"Memory-size" > On Wed, 15 Oct 2008, B. Bogart wrote: [...] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] rgl-snapshot failed (err-msg: "failed")

2008-10-15 Thread Duncan Murdoch
On 10/10/2008 8:55 AM, Oliver Bandel wrote: Zitat von Duncan Murdoch <[EMAIL PROTECTED]>: On 10/10/2008 8:13 AM, Oliver Bandel wrote: > Hello, > > > I tried to use rgl.snapshot and it failed. > > The error message was not very verbose: > > > > == >> >> plot3d( motion[[idx+2]

Re: [R] YALAQ - Yet Another LApply Question

2008-10-15 Thread Thompson, David (MNR)
Thank you very much Greg. Apparently, my learning curve is still well below it's horizontal asymptote. And no wonder in the vast universe of the R-project, eh? Thanx, DaveT. >-Original Message- >From: Greg Snow [mailto:[EMAIL PROTECTED] >Sent: October 15, 2008 01:52 PM >To: Thompson, Davi

  1   2   >