Re: [R] Arbitrary Precision Numbers

2008-04-04 Thread Gabor Grothendieck
Here is the link: http://ryacas.googlecode.om On Fri, Apr 4, 2008 at 9:55 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Have a look at the Ryacas package which interfaces R to yacas. > yacas can do exact arithmetic. > > > On Fri, Apr 4, 2008 at 11:43 AM, Rory Winston <[EMAIL PROTECTED]> wrot

Re: [R] Arbitrary Precision Numbers

2008-04-04 Thread Gabor Grothendieck
Have a look at the Ryacas package which interfaces R to yacas. yacas can do exact arithmetic. On Fri, Apr 4, 2008 at 11:43 AM, Rory Winston <[EMAIL PROTECTED]> wrote: > > Hi > > (If you're wondering, this is a Project Euler question :)) > > If I wanted to calculate the sum of the digits in the dec

Re: [R] Arbitrary Precision Numbers

2008-04-04 Thread jim holtman
One way of "doing it in R" is to use the 'bc' command that is on most UNIX/LINUX systems and is also on cygwin for Windows. Here are decimal digits for 2^1000 /cygdrive/c/jph/consulting/2008-03-30: bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free softwa

[R] How to access the attributes of a ggplot?

2008-04-04 Thread Tribo Laboy
Hi, I am having some hard time figuring how to access (and modify) the properties of an object created by ggplot. I found 'ggopts', but it only returns some of the properties. Say I want to get the x- and y-axis limits, the tickmark locations, legend current position, the legend box and backgrou

Re: [R] format numbers using 1000 separator

2008-04-04 Thread Austin, Matt
> format(10, big.mark=",", scientific=FALSE) [1] "1,000,000,000" --Matt Matt Austin Biostatistics Director Amgen, Inc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of tom soyer Sent: Friday, April 04, 2008 2:41 PM To: r-help@r-project.org Subject

Re: [R] Reading an ArcGIS raster file

2008-04-04 Thread Liviu Andronic
Hello, On Fri, Apr 4, 2008 at 8:09 PM, Martin Rittner <[EMAIL PROTECTED]> wrote: > I don't know too much about R myself, but a little about ArcGIS: Doesn't grass [1] assure some kind of compatibility with ArcGIS, so as to provide you with a "readable" file? This page [2] may be of interest. Livi

Re: [R] format numbers using 1000 separator

2008-04-04 Thread Peter Dalgaard
tom soyer wrote: > Hi, > > Does anyone know how one could format numbers using 1000 separator in R? For > example, format 1000 as 1,000 and 10 as 100,000, etc. > > Thanks, You're at the mercy of the system sprintf, but on Fedora, this works: > Sys.setlocale("LC_NUMERIC","da_DK.UTF-8") [1] "da

[R] format numbers using 1000 separator

2008-04-04 Thread tom soyer
Hi, Does anyone know how one could format numbers using 1000 separator in R? For example, format 1000 as 1,000 and 10 as 100,000, etc. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.

Re: [R] loop? apply? I want to repeat a task through 208 itterations.

2008-04-04 Thread anna freni sterrantino
hi Stephen, you may want to check ?apply What you want is : a<-matrix(1:120,10,20) a[1:8,1:2]=NA apply(a,2, function(x) if(sum(!is.na(x)) > (length(x)-3)) shapiro.test(x) else NA ) Cheers Anna - Messaggio originale - Da: stephen sefick <[EMAIL PROTECTED]> A: r-help@r-project.org I

Re: [R] loop? apply? I want to repeat a task through 208 itterations.

2008-04-04 Thread jim holtman
I think this is what you want to do. I did not have 'shaprio.test' so I just returned a value: > x <- structure(list(RM215alk = c(15, 13, 12, 14, NA, 13, 16, 13, 16, + #subset of data + 13, 17, 13, 19, 13, 14, 14, 15, 15, 14, 16, 14, 15, 13, 14), +NSCl = c(NA, NA, 2.9, NA, NA, NA, NA, NA, NA,

[R] [R-pkgs] cacher v0.1-2

2008-04-04 Thread Roger D. Peng
The 'cacher' package contains a set of routines for caching statistical analyses. The idea is that an analysis stored in a file (say, 'foo.R') is run and the results of the evaluated expressions are cached in a database. These cached results can subsequently be packaged up and distributed over

Re: [R] how to fit GJR-GARCH model in R

2008-04-04 Thread saikat sarkar
If I understand correct then garch.gjr <- function(par,y,iterate=TRUE) { T<-length(y) mu0<-par[1] a0<-par[2] a1<-par[3] a2 <-par[4] b1 <- par[5] e <- s2 <- numeric(T) s2[1] <- var(y) e[1] <- y[1]-mu0 l<-0 for(t in 2:T) { e[t] <- y[t]-mu0 s2[t] <- a0+a1*e[t-1]^2+b1*s2[t-1] + ifelse(e[t-1

Re: [R] lme4: How to specify nested factors, meaning of : and %in%

2008-04-04 Thread Claus Wilke
A quick correction to my earlier email: > The problem that I have with this analysis is that Treatment gets both a > fixed and a random effect [1]. So I would like to remove the fixed effect > from Treatment, but I'm not sure how to do this. Is the following correct? I meant: "I would like to remov

[R] lme4: How to specify nested factors, meaning of : and %in%

2008-04-04 Thread Claus Wilke
Hello list, I'm trying to figure out how exactly the specification of nested random effects works in the lmer function of lme4. To give a concrete example, consider the rat-liver dataset from the R book (rats.txt from: http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/ ). Crawley suggests

Re: [R] predict.glm & newdata

2008-04-04 Thread Daniel Malter
Hi, could it be the "newdata" argument? When I run predict with the newdata argument, I get an error message - a different one though. The second reason might be that your dataset is named df, which is defined as a function an may produce problems. Try renaming the dataset. yhat=predict(reg1,newd

Re: [R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
Here is the solution data<-read.table("d:/ftse.txt",header=TRUE) wDay<-as.Date(data$date,"%d/%m/%Y") data<-data.frame(data[,-1]) price<-data$ftse100 data<-data.frame(price,wDay) data[1:10,] a<-as.Date("03/01/1989","%d/%m/%Y") b<-as.Date("31/01/2007","%d/%m/%Y") ab<-seq(a,b,by=1) c<-

Re: [R] Reading an ArcGIS raster file

2008-04-04 Thread Martin Rittner
I don't know too much about R myself, but a little about ArcGIS: As far as I know, the .aux files ArcGIS produces do not hold the actual data, but metadata. The actual file should have some other extension (dat, tif, hgz, img, csv... many more), but with rather small datasets the metadata may b

Re: [R] iterative loop with user input?

2008-04-04 Thread Christopher Marcum
Hi All, Thank you for your solutions. They all seem reasonable and I will be testing these out later this evening. I'm replying to the list because I think these solutions will come in handy to those using R as a programming language. -Chris Marcum Sociology/Cal(it)^2 University of California -

Re: [R] pairwise.t.test for paired data

2008-04-04 Thread francogrex
francogrex wrote: > > ... > I have no indication that the test is taking into account that the data > are paired! Is it possible to do a pairwise t test with adjustement for > multiple comparisons using pairwise.t.test? If not any other function for > that? Thanks. > Dear all, Peter Dalgaard h

Re: [R] pairwise.t.test for paired data

2008-04-04 Thread Peter Dalgaard
francogrex wrote: > Dear R-help, I have a question about pairwise.t.test and adjustment for > multiple comparisons for paired data points. > I have the following data: > > n=c("x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "y", "y", > "y", "y", "y", "y", "y", "y", "y", "y", "z", "z", "z", "z",

[R] predict.glm & newdata

2008-04-04 Thread Tom Guston
Hi all - I'm stumped by the following mdl <- glm(resp ~ . , data = df, family=binomial, offset = ofst) WORKS yhat <- predict(mdl) WORKS yhat <- predict(mdl,newdata = df) FAILS Error in drop(X[, piv, drop = FALSE] %*% beta[piv]) : subscript out of bounds I've tried without offset, quoting

Re: [R] Cannot run R from command prompt

2008-04-04 Thread Gabor Grothendieck
Did you start up a new command line session after setting the path? Also note that at http://batchfiles.googlecode.com there are batchfiles: R.bat, Rcmd.bat etc. They can be placed anywhere in your path and then you can just write R or Rcmd, etc. With those you don't have to change your path at

[R] Cannot run R from command prompt

2008-04-04 Thread Vidhu Choudhary
Hello, I have installed R 2.6 on windows 2000 and now from the command prompt when I type R it show " 'R' is not recognized as an internal or external command, operable program or batch file." If I change the path to C:\R\R-2.6.2\bin and then type R it runs fine. I have changed my envionment vari

Re: [R] random forest varimp

2008-04-04 Thread Liaw, Andy
Please see the "Details" section of ?importance in the package. Andy From: [EMAIL PROTECTED] > > Friends, > I have noticed that many publications that use RF report > variable importance as > a function of mean decrease in accuracy rather than mean > decrease in gini. Am I > correct that the

[R] pairwise.t.test for paired data

2008-04-04 Thread francogrex
Dear R-help, I have a question about pairwise.t.test and adjustment for multiple comparisons for paired data points. I have the following data: n=c("x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "z", "z", "z", "z", "z", "z", "z", "z", "z", "z

[R] Arbitrary Precision Numbers

2008-04-04 Thread Rory Winston
Hi (If you're wondering, this is a Project Euler question :)) If I wanted to calculate the sum of the digits in the decimal representation of 2^1000, what would be a good way to go about that? I've tried the following methods: # Calculate the sum of digits in the decimal representation of 2^n

Re: [R] NA vs.

2008-04-04 Thread Muenchen, Robert A (Bob)
Peter & Hadley, thanks for the clarification. The NA=North America example reminds me of a text analysis problem in which "TO" meant "Take Off" for pilots. Of course many text analysis programs toss supposedly low-information words like that! Thanks, Bob > -Original Message- > From: Pet

Re: [R] NA vs.

2008-04-04 Thread Peter Dalgaard
Muenchen, Robert A (Bob) wrote: > Dear R-Helpers, > > Why does R show character missing values in vectors as NA and when > stored in a data frame as ? I've searched but did not find an > explanation. > > Thanks, > Bob > > >> gender <- c("f","f","f",NA,"m","m","m","m") >> gender >> > [1] "f"

Re: [R] NA vs.

2008-04-04 Thread hadley wickham
On Fri, Apr 4, 2008 at 11:00 AM, Muenchen, Robert A (Bob) <[EMAIL PROTECTED]> wrote: > Dear R-Helpers, > > Why does R show character missing values in vectors as NA and when > stored in a data frame as ? I've searched but did not find an > explanation. It's because that character vector is auto

[R] NA vs.

2008-04-04 Thread Muenchen, Robert A (Bob)
Dear R-Helpers, Why does R show character missing values in vectors as NA and when stored in a data frame as ? I've searched but did not find an explanation. Thanks, Bob > gender <- c("f","f","f",NA,"m","m","m","m") > gender [1] "f" "f" "f" NA "m" "m" "m" "m" #here it lacks brackets. > > q1 <

[R] random forest varimp

2008-04-04 Thread helen . mills
Friends, I have noticed that many publications that use RF report variable importance as a function of mean decrease in accuracy rather than mean decrease in gini. Am I correct that the mean decrease in accuracy is just the mean decrease in gini divided by 100? Thanks, Helen Mills Poulos Yale Scho

[R] loop? apply? I want to repeat a task through 208 itterations.

2008-04-04 Thread stephen sefick
structure(list(RM215alk = c(15, 13, 12, 14, NA, 13, 16, 13, 16, #subset of data 13, 17, 13, 19, 13, 14, 14, 15, 15, 14, 16, 14, 15, 13, 14), NSCl = c(NA, NA, 2.9, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("RM215alk", "NSCl"), class = "d

Re: [R] How can we creat conditional data frame

2008-04-04 Thread bartjoosen
Hello, altough I'm not an expert, I found a solution (maybe not the most elegant.) d<-as.Date(c("2000/01/03","2000/01/05","2000/01/19","2000/01/28")) r<-rnorm(4) da<-data.frame(d,r) a<-as.Date("01/01/2000","%d/%m/%Y") b<-as.Date("30/01/2000","%d/%m/%Y") ab<-seq(a,b,by=1) c<-format(ab,

Re: [R] Security issue

2008-04-04 Thread David Winsemius
Markus Gesmann <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > If this is not enough, the following document might help you do find > some good arguments: http://www.actuaries.org.uk/files/pdf/proceedings/giro2006/Maynard.pdf That link is dead, ... perhaps one of: http://www.actuarie

Re: [R] RODBC / odbcConnectExcel Issue

2008-04-04 Thread James W. MacDonald
Hi Vishal, Vishal Belsare wrote: > Can someone throw light on the following problem I am having with RODBC? > There's an Excel file I am trying to read from, it has one sheet named > 'nameclass'. > > Thanks in anticipation. > > > Vishal Belsare > > >> library(RODBC) >> con = odbcConnectExcel(

Re: [R] How can we creat conditional data frame

2008-04-04 Thread Gabor Grothendieck
The last line should have been: z <- merge(r = tmp.z, weekday = as.numeric(format(time(date.z), "%w")), h = !tmp.z) On Fri, Apr 4, 2008 at 8:25 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Have a look at the zoo package. After reading > in the data its only 2 lines of code. > > Not

Re: [R] How can we creat conditional data frame

2008-04-04 Thread Henrique Dallazuanna
If I understand: res <- merge(date, da, by.x = "ab", by.y="d", all=T) res$h <- 0 res$h[is.na(res$r)] <- 1 res$r[is.na(res$r)] <- 0 On Fri, Apr 4, 2008 at 8:49 AM, saikat sarkar <[EMAIL PROTECTED]> wrote: > > Hi, > > R experts. I am a new user of R and trying to learn this program. > > I have a

Re: [R] How can we creat conditional data frame

2008-04-04 Thread Gabor Grothendieck
Have a look at the zoo package. After reading in the data its only 2 lines of code. Note that zoo objects can be numeric or factor but not both so we have represented the day of the week as 1 for Mon, etc. in the final object. You could convert it to a data frame at the end if you really need t

Re: [R] Design package lrm summary and factors

2008-04-04 Thread Frank E Harrell Jr
sj wrote: > Hello, I have question regarding the lrm function and estimating the odds > ratio between different levels of a factored variable. > The following code example illustrates the problem I am having. I have a > data set with an outcome variable (0,1) and an input variable (A,B,C). I > woul

Re: [R] Problems with Unit Root testing using ur.df function

2008-04-04 Thread Matthieu Stigler
Matthieu Stigler a écrit : > Hi All, > > I'm new to R and am trying to run a unit root test on the vector "y" > (a time > series of inflation (i.e. changes in the Consumer Price Index quarter on > quarter)). > I've run the Augmented-Dickey-Fuller Test below (R's URCA package). It > gives > me an

Re: [R] What to do with this data?

2008-04-04 Thread Jim Lemon
mika03 wrote: > ... > Here's what we did: > We showed a fairly large number of subjects search engine queries and > different possible search engine responses. We assumed that users would like > some our responses better than others and wanted to check this. Subjects > could rate a query/response p

[R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
Hi, R experts. I am a new user of R and trying to learn this program. I have a problem. Here is the code. d<-as.Date(c("2000/01/03","2000/01/05","2000/01/19","2000/01/28")) r<-rnorm(4) da<-data.frame(d,r) a<-as.Date("01/01/2000","%d/%m/%Y") b<-as.Date("30/01/2000","%d/%m/%Y") ab<-seq(a,b,by=

[R] How can we creat conditional data frame

2008-04-04 Thread saikat sarkar
Hi, R experts. I am a new user of R and trying to learn this program. I have a problem. Here is the code. d<-as.Date(c("2000/01/03","2000/01/05","2000/01/19","2000/01/28")) r<-rnorm(4) da<-data.frame(d,r) a<-as.Date("01/01/2000","%d/%m/%Y") b<-as.Date("30/01/2000","%d/%m/%Y") ab<-seq(a,b,by=

[R] Reading an ArcGIS raster file

2008-04-04 Thread Juliane Struve
Dear members, How can I read and plot an ArcGIS raster file into R ? The file has extension .aux and contains floating point bathymetry data. The purpose is to create a spatial model in R that uses ArcGIS map data. I have managed to read and plot various shape files into my R project, but I am

[R] Problems with Unit Root testing using ur.df function

2008-04-04 Thread Leyla Biondini
Hi All, I'm new to R and am trying to run a unit root test on the vector "y" (a time series of inflation (i.e. changes in the Consumer Price Index quarter on quarter)). I've run the Augmented-Dickey-Fuller Test below (R's URCA package). It gives me an error that it cannot find the function ur.d

[R] RODBC / odbcConnectExcel Issue

2008-04-04 Thread Vishal Belsare
Can someone throw light on the following problem I am having with RODBC? There's an Excel file I am trying to read from, it has one sheet named 'nameclass'. Thanks in anticipation. Vishal Belsare > library(RODBC) > con = odbcConnectExcel(file.choose()) > tbls <- sqlTables(con) > tbls

[R] Predictive Analytics for Business, Marketing and Web (May 8-9 and June 5-6)

2008-04-04 Thread Elise Johnson
http://www.nabble.com/file/p16489822/logo-300-pix-72-dpi-no-sub.jpg Predictive Analytics for Business, Marketing and Web is a concentrated training program that includes interactive breakout sessions. Dates: May 8-9 and June 5-6, 2008 Locations: San Francisco (May), New York City (June) Sponsor

Re: [R] getting serial anovas from a complex lm object obtained with a matrix of responses

2008-04-04 Thread bartjoosen
Hi, I'm not aware of a way to do this without some looping/applying, but this should do the trick: x <- 1:10 y <- rnorm(100,x,0.5) dim(y) <- c(10,10) mod <- lm(y~x) do.call(rbind,lapply(summary(mod),function(x) coefficients(x)[,4])) This will give you the p values/model Bart Mark W Kimpel

Re: [R] prettyR 25% quartile, 75% quartile

2008-04-04 Thread Jim Lemon
stephen sefick wrote: > I am using the describe function in prettyR. I would like to add the > 25% 75% quartiles to the summary table > > how do I do this > > I have tried > > describe(x.f, num.desc=c("mean", "median", "sd", "min", "max", > "skewness", "quantile(x.f, na.rm=T, probs=seq(0.25, 0.

Re: [R] iterative loop with user input?

2008-04-04 Thread bartjoosen
Your example runs fine at my pc, except from the readLines("File with 30 ) part. But this is probably a striped code, so maybe you should take a look at flush.console(). Bart Christopher Marcum wrote: > > Hello R-Users, > > I would like to use an iterative loop to collect user input from

[R] Loosing attributes while binding data frames ...

2008-04-04 Thread Tribo Laboy
Hello I want to keep track of my units in the data frame. I have been advised in the past on this list to create a new "units" attribute of the data frame and keep the units strings there. It works fine as long as I don't manipulate the data frame. Here's an example: -CODE BEGIN

Re: [R] How to include files in .R?

2008-04-04 Thread Mark Wardle
?source bw Mark On 04/04/2008, Jonas Stein <[EMAIL PROTECTED]> wrote: > Hi, > > may be its a very simple question, but i did not find any documentation > about a 'include' command or something like this. > > I have to set many constants in my R-files and want to move all these to > one file,

[R] How to include files in .R?

2008-04-04 Thread Jonas Stein
Hi, may be its a very simple question, but i did not find any documentation about a 'include' command or something like this. I have to set many constants in my R-files and want to move all these to one file, so that i can reuse it in all other R-files. Something like include("~/R/myconstants.

Re: [R] ps or pdf

2008-04-04 Thread Tribo Laboy
> The graphics devices are very similar (they share a lot of code). One > small difference is that PostScript has an arc primitive, and PDF does > not. > Sorry for interjecting, but I have a burning question. It is a bit off topic, so I apologize in advance. What is the stance of the R Develo

Re: [R] Combining several mappings in ggplot2

2008-04-04 Thread Tribo Laboy
Hi Thiery, Thanks for the corrected line. I did manage to plot it now, but instead of one unified legend now I have two separate legends - one for the 5 colors, Marked with "Tree" on the top and another for the 4 linetypes, marked with "Lines" at the top. any idea how to unify them? Regards, TL