Re: [R] OT: any recommendation for scripting language

2006-12-23 Thread Gabor Grothendieck
I used gawk and perl prior to using R but as I got more proficient in R I found I could do just about everything in R itself and have largely forgotten perl at this point and rarely use gawk either. I must say I never liked perl and if python were more mature back then I probably would have used

Re: [R] Math expression with object to evaluate

2006-12-22 Thread Gabor Grothendieck
Use bquote: ID - 3 plot(1,1, main = bquote(ID ~ is ~ .(ID))) Also please read the last line of every message to r-help regarding reproducible examples. (None of your variables were defined.) On 12/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello. I have a question that probably has a

Re: [R] multiline system call

2006-12-22 Thread Gabor Grothendieck
Its only available on Windows. On 12/22/06, Nicolas Mazziotta [EMAIL PROTECTED] wrote: Dear Sir, Le vendredi 22 décembre 2006 20:05, vous avez écrit : system(sh,intern=T,input=c(echo x,echo y)) Thanks for the advice, but I do not find doc about the input arg for the system function.

Re: [R] call by reference

2006-12-21 Thread Gabor Grothendieck
You can do this: fb - function(bS, env = parent.frame()) { bS - deparse(substitute(bS)) assign(bS, 3, env = env) } fb(bS) bS rm(bS) # or corresponding to your code fb(bS, env = .GlobalEnv) Of course when typed in both give the same result since the global

Re: [R] data - data matrix that can be used in regressions

2006-12-21 Thread Gabor Grothendieck
Do a google search for cran contributed documentation and at the first hit you will find numerous introductions that may be of use to you. Also read the last line of every post to r-help. On 12/21/06, Ulrich Kaiser [EMAIL PROTECTED] wrote: Dear R users, I have spent most of this day

Re: [R] How to use strings from a data.frame as the argument of an expression() for plot

2006-12-20 Thread Gabor Grothendieck
Try this: e - expression(O[3], NO, NO[2]) opar - par(mfrow = c(2,2)) for(i in 1:3) plot(1, 1, type = b, main = bquote(.(e[[i]]) ~ Year ~ 2005)) par(opar) Also please read the last line to every post to r-help and particularly note the part about reproducible examples. x and y.were undefined.

Re: [R] How to use strings from a data.frame as the argument of an expression() for plot

2006-12-20 Thread Gabor Grothendieck
Just store them as strings in the data frame and then perform a conversion to expressions prior to the loop: DF - data.frame(s = c(O[3], NO, NO[2]), stringsAsFactors = FALSE) e - parse(text = DF$s) ... continue with prior solution ... On 12/20/06, MrJ Man [EMAIL PROTECTED] wrote: Thanks for

Re: [R] Problem in Dates

2006-12-19 Thread Gabor Grothendieck
Read R News 4/1 help desk article and the last line of every message to r-help. Also putting POSIXlt objects into data frames is asking for trouble. On 12/19/06, Shubha Karanth [EMAIL PROTECTED] wrote: Hi Experts, I have a problem in Dates. I have a zoo object called 'intra'. And the

Re: [R] Collapsing across trials

2006-12-17 Thread Gabor Grothendieck
Try aggregate(DF[4], DF[1:3], mean) On 12/16/06, Pedro Alcocer [EMAIL PROTECTED] wrote: Hello, My ultimate goal is a repeated measures (mixed model) ANOVA, however, my present question is about how to reorganize my data into the format that the ANOVA commands expect. In particular, how to

Re: [R] Hourly Time Series

2006-12-16 Thread Gabor Grothendieck
Using zoo would allow you to retain the date/time portion. In ts you would have to represent them as numbers; however, as you can easily switch from zoo to ts you probably want to use zoo in the first instance: library(zoo) library(chron) Lines - DateIDHourIDMetrics 200609200

Re: [R] using zoo for daily stock prices

2006-12-16 Thread Gabor Grothendieck
See aggregate.zoo and maybe ?rollapply For date manipluations see R News 4/1 help desk article and the table at the end of that article, in particular. Suggest you also read and follow the last line on every r-help message when posting. On 12/10/06, Alfonso Sammassimo [EMAIL PROTECTED] wrote: Hi

Re: [R] lattice: defining an own function using args for formula and groups

2006-12-08 Thread Gabor Grothendieck
Don't know of a more straight forward way but this works. It constructs a new call to bwplot from the one to x.grp2 and evaluates it in the parent environment: library(lattice) x.grp2 - function(x, groups, data) { cl - match.call() cl[[1]] - as.name(bwplot) eval.parent(cl) } x.grp2(

Re: [R] templating library for R

2006-12-07 Thread Gabor Grothendieck
I am not familiar with velocity or freemarker but the gsubfn package can do string interpolation somewhat similar to perl. The gsubfn and strapply functions in that package can handle arbitrary regular expressions in a similar way. See: http://code.google.com/p/gsubfn/ On 12/7/06, Ido M.

Re: [R] How to use read.xls in R

2006-12-07 Thread Gabor Grothendieck
You need perl installed for it to work. Although you normally would not need to use them note the verbose= and perl= arguments on the read.xls command. If you don't want to install perl try using RODBC: library(RODBC) z - odbcConnectExcel(/a.xls) dd - sqlFetch(z,Sheet1)

Re: [R] Usage of apply

2006-12-06 Thread Gabor Grothendieck
Google for contributed documentation CRAN and in the first hit look through the several dozen tutorials there until you find one that describes the apply functions in a way meaningful to you. There is also some tutorial information on the relevant portion of this page:

Re: [R] Adding terms to a function

2006-12-06 Thread Gabor Grothendieck
Using the builtin anscombe data set try this where we note that the first 4 columns are x1, ..., x4 and the fifth column is y1. for(i in 1:4) print(coef(lm(y1 ~., anscombe[c(1:i, 5)]))) On 12/6/06, Brooke LaFlamme [EMAIL PROTECTED] wrote: Hi all, I am running R version 2.4.0 on Windows

Re: [R] backticks

2006-12-04 Thread Gabor Grothendieck
On 12/4/06, Peter Dalgaard [EMAIL PROTECTED] wrote: Robin Hankin wrote: Peter Aha! so R backticks work just like bash backticks (duh!) Er, no. Backticks in shells have a command inside that will be evaluated and replaced by its output. (This is a bit confusing, but single and double

Re: [R] error using environment(f) - NULL

2006-12-02 Thread Gabor Grothendieck
Try : environment(f) - baseenv() There is also emptyenv() depending on what you want. See ?baseenv On 12/2/06, Carmen Meier [EMAIL PROTECTED] wrote: Hi To all, I found in the tread http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46740.html the reply for / y - 3 / / f - function(x) y

Re: [R] Fwd: Urgent Help in Paste Command

2006-12-02 Thread Gabor Grothendieck
Try this: x - readline() C:\Program Files\R\R-2.4.0\bin\Rgui.exe x [1] C:\\Program Files\\R\\R-2.4.0\\bin\\Rgui.exe You can also use readLines(clipboard) if you are trying to read in something from the clipboard. On 12/2/06, Shubha Karanth [EMAIL PROTECTED] wrote: Hi Experts, I

Re: [R] Fwd: Urgent Help in Paste Command

2006-12-02 Thread Gabor Grothendieck
Files\\R\\R-2.4.0\\bin\\Rgui.exe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Saturday, December 02, 2006 5:21 PM To: Shubha Karanth Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Fwd: Urgent Help in Paste Command Try

Re: [R] specify point shape for ggplot (equivalent to pch)?

2006-12-02 Thread Gabor Grothendieck
See the last example in ?qplot On 12/1/06, Rainer M Krug [EMAIL PROTECTED] wrote: Hi is it possible to specify the shape of the point to be used in ggplot (as with pch in plot)? I couldn't find anything in the help. Thanks Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc

Re: [R] legend in lattice densityplot

2006-11-30 Thread Gabor Grothendieck
Yes by using the lty suboption of superpose.line. Here is a modification of the prior example to illustrate: We also use lwd as well in this example. set.seed(1) DF - data.frame(x = c(rnorm(100,1,2),rnorm(100,2,4),rnorm(100,3,6)), f = sample(c(A,B,C,D,E),300,replace=TRUE))

Re: [R] legend in lattice densityplot

2006-11-30 Thread Gabor Grothendieck
, xmlHeader=TRUE) densityplot(...) dev.off() I am getting all the lines as continuous, not dashed... On 11/30/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Yes by using the lty suboption of superpose.line. Here is a modification of the prior example to illustrate: We also use

Re: [R] Expression

2006-11-30 Thread Gabor Grothendieck
Try: plot(1, main = ~ D[obs]^*) On 11/30/06, Guenther, Cameron [EMAIL PROTECTED] wrote: Hi all, I have a question about expression. In a figure I want to include the term D*obs with the star as as superscript and obs as subscript. I have even just tried to get the star to be superscript.

Re: [R] escape character to get printed in output

2006-11-30 Thread Gabor Grothendieck
It did work. That's how print represents strings. Try: cat(hello \hello\ hello) hello hello hello strsplit(hello \hello\ hello, )[[1]] [1] h e l l o \ h e l l o \h [16] e l l o On 11/30/06, roger bos [EMAIL PROTECTED] wrote: I want to use R to run dos commands (either

Re: [R] writing function with ,... )

2006-11-30 Thread Gabor Grothendieck
Try this: test - function(x, ...) { + print(x) + dots - list(...) + if (y %in% names(dots)) print(dots$y) + } test(3, y = 43) [1] 3 [1] 43 test(4, z = 44) [1] 4 On 11/30/06, Carmen Meier [EMAIL PROTECTED] wrote: Hi to all I did not found the right hints for functions with the dot-dot-dot

Re: [R] R2.4 xyplot + panel.number problem

2006-11-29 Thread Gabor Grothendieck
As requested on last line of every message to r-help please provide self contained reproducible code. Also please space it properly since its very difficult to read in your post. I have used the models defined in example(Puromycin) in place of your undefined ones and made some changes to keep

Re: [R] comma delimiter comma in tex

2006-11-29 Thread Gabor Grothendieck
Preprocess the file surrounding the last field with quotes. The xx - line is for purposes of making it self contained here and in reality would be replaced with the commented line above it. It simply reads the text in. The yy - line then surrounds the fourth field with double quotes assuming at

Re: [R] String question

2006-11-29 Thread Gabor Grothendieck
Try: # TRUE if all 0 and 1 regexpr(^[01]*$, bits) 0 # positions of 1s gregexpr(1, bits)[[1]] On 11/29/06, Carmen Meier [EMAIL PROTECTED] wrote: Hi to all I would to determinate whether bits is a binary code and I would to find out the which bit is set to 1 bits -00110110 I found to

Re: [R] showing available environment variables

2006-11-29 Thread Gabor Grothendieck
These retrieve and set environment variables: ?Sys.getenv ?Sys.putenv On 11/29/06, Karin Lagesen [EMAIL PROTECTED] wrote: I have searched through the mailing lists and the docs, and I seem completely unable to find a way to make R list all available environment variables that it uses. The

Re: [R] simple R question

2006-11-29 Thread Gabor Grothendieck
Try creating a zoo object from your data frame # data from your post DF - structure(list(Date = as.integer(c(20061122, 20061115, 20061108, 20061101, 20061025, 20061018, 20061011, 20061004, 20060927)), IBM = as.integer(c(12, 12, 12, 12, 12, 12, 11, 12, 10)), MSFT = as.integer(c(4, 4, 4, 4,

Re: [R] legend in lattice densityplot

2006-11-29 Thread Gabor Grothendieck
Try specifying it at the par.settings= level since that is where both the plot and the legend get it from: set.seed(1) DF - data.frame(x = c(rnorm(100,1,2),rnorm(100,2,4),rnorm(100,3,6)), f = sample(c(A,B,C,D,E),300,replace=TRUE)) library(lattice) densityplot(~ x, DF, groups = f, auto.key

Re: [R] Aggregating data

2006-11-29 Thread Gabor Grothendieck
Using the builtin data set CO2: aggregate(CO2[4:5], CO2[1], mean) calculates the means of variables 4 and 5 based combinations of the levels of variable 1. Is that what you want? On 11/29/06, David Kaplan [EMAIL PROTECTED] wrote: Chuck and others. Here is the problem I need help on.

Re: [R] Aggregating data

2006-11-29 Thread Gabor Grothendieck
I meant: calculates the means of variables 4 and 5 based on the levels of variable 1. Is that what you want? On 11/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Using the builtin data set CO2: aggregate(CO2[4:5], CO2[1], mean) calculates the means of variables 4 and 5 based

Re: [R] Removing terms from formula

2006-11-29 Thread Gabor Grothendieck
Do you really want the 1? Normally the intercept is not explicitly given unless there are no other terms in the formula so assuming you only want it if you have otherwise removed all the variables then: zap1 - function(fo) { L - sapply(all.vars(fo[[length(fo)]]), function(x)

Re: [R] Removing terms from formula

2006-11-29 Thread Gabor Grothendieck
)]]), function(x) nlevels(get(x, environment(fo))), simplify = FALSE) fo - eval.parent(do.call(substitute, list(fo, L[c(L) == 1]))) update(fo, . ~ .) } # test data x - y - 1:3 z - factor(0*x) fo - x ~ y + z # test zap1(fo) # x ~ y y - z zap1(fo) # x ~ 1 On 11/30/06, Gabor Grothendieck

Re: [R] Sorting a data frame when you don't know the columns

2006-11-28 Thread Gabor Grothendieck
DF - data.frame(a = c(3, 4, 2, 3, 2, 4, 2), b = 7:1)) DF[do.call(order, DF),] will sort on all the columns. On 11/28/06, michael watson (IAH-C) [EMAIL PROTECTED] wrote: Hi Sorry to ask such a well oiled question, but even with multiple google hits I don't think this has been answered very

Re: [R] delete content of directory - unlink doesn't work as expected

2006-11-28 Thread Gabor Grothendieck
Maybe: file.remove(file.path(myDir, list.files(myDir))) or here - setwd(myDir) file.remove(list.files()) setwd(here) On 11/28/06, Hans-Peter [EMAIL PROTECTED] wrote: Hi, I try to delete the files in a directory. While the command invisible(lapply( list.files( DeleteThis ), function(x)

Re: [R] Extract some character from a character vector of length 1

2006-11-28 Thread Gabor Grothendieck
The following matches pat1 followed by an ungreedy match of what is in between followed by pat2. What is in between is defined to be backreference 1 which is returned. See: http://code.google.com/p/gsubfn/ for more on strapply and the gsubfn package. # test data a - something2 pat1

Re: [R] NaN with ccf() for vector with all same element

2006-11-27 Thread Gabor Grothendieck
The denominator holds the variance and since the variance is zero you get that. Calculate the covariance instead of the correlation: ccf(x, y, plot = FALSE, type = cov) On 11/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hello, i have been using ccf() to look at the correlation

Re: [R] adding elemens to a list

2006-11-26 Thread Gabor Grothendieck
If DF is the data frame in your post then turn it into a zoo object, convert that to class ts and then back to zoo replacing NA's with zero: library(zoo) z - zoo(DF$Freq, as.yearmon(as.Date(paste(DF$Var1, 01, sep = - zz - as.zoo(as.ts(z)) zz[is.na(zz)] - 0 Suggest you read the

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
-0520 Voice: (865) 974-5230 FAX: (865) 974-4810 Email: [EMAIL PROTECTED] Web: http://oit.utk.edu/scc, News: http://listserv.utk.edu/archives/statnews.html = -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED

Re: [R] Ryacas not working properly

2006-11-25 Thread Gabor Grothendieck
Ryacas starts up yacas with an initialization file R.ys which puts the server in a mode which outputs XML (which is what Ryacas reads). It does that by specifying --init /whatever/R.ys on the yacas command line when it is run. You can run yacas without that init file or you can just enter into

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
if the original if is false. The check for f when not m I put in only to exclude missing values for gender. Thanks!! Bob -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Saturday, November 25, 2006 7:37 AM To: Muenchen, Robert A (Bob) Cc: r-help

Re: [R] OT: P(Z = -1.46).

2006-11-25 Thread Gabor Grothendieck
Based on integration it appears that .0721 is correct. integrate(function(x) exp(-x^2/2)/(2*pi)^.5, -Inf, -1.46) 0.07214504 with absolute error 1.2e-07 On 11/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In checking over the solutions to some homework that I had assigned I observed the

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here are some additional solutions. It appears that the SAS code is performing the transformation row by row and for each row the code in your post is specifying the transformation so if you want to do it that way we could use 'by' like this (where

Re: [R] Using roman and italic fonts in an xlab expression for a plot

2006-11-24 Thread Gabor Grothendieck
or even shorter: plot(1, xlab = Level is ~ italic(M)) On 11/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: plot(1, xlab = quote(Level is ~ italic(M))) or plot(1, xlab = quote(Level ~ is ~ italic(M)) On 11/23/06, Philip Boland [EMAIL PROTECTED] wrote: Just wondering

Re: [R] vector problem

2006-11-24 Thread Gabor Grothendieck
merge.zoo can do that: p1 - 100 p2 - c(20, 80) p3 - c(40, 10, 50) library(zoo) t(merge(p1 = zoo(p1), p2 = zoo(p2), p3 = zoo(p3), fill = 0)) 1 2 3 p1 100 0 0 p2 20 80 0 p3 40 10 50 On 11/24/06, bunny , lautloscrew.com [EMAIL PROTECTED] wrote: my vector of answers could have a

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Gabor Grothendieck
Try this: transform(mydata, score1 = (2 + (gender == m)) * q1 + q2, score2 = (2.5 + (gender == m)) * q1 + q2 ) On 11/24/06, Muenchen, Robert A (Bob) [EMAIL PROTECTED] wrote: Mark, I finally got that approach to work by spreading the logical condition everywhere. That gets the

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Gabor Grothendieck
And here is a variation: transform(mydata, score1 = (2 + (gender == m)) * q1 + q2, score2 = score1 + 0.5 * q1 ) or transform( transform(mydata, score1 = (2 + (gender == m)) * q1 + q2), score2 = score1 + 0.5 * q1 ) On 11/25/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try

Re: [R] loess lines in xyplot with two or more variables on the left side of a formula

2006-11-23 Thread Gabor Grothendieck
Try this: xyplot(IDUPREV + VALIDAT~ YEAR | MSA, data = df, type= c(smooth, o)) On 11/23/06, Chuck Cleland [EMAIL PROTECTED] wrote: Hello: I recall something like this being discuss recently, but I can't seem to locate an example in the archives. I have data like the following: df -

Re: [R] Using roman and italic fonts in an xlab expression for a plot

2006-11-23 Thread Gabor Grothendieck
Try this: plot(1, xlab = quote(Level is ~ italic(M))) or plot(1, xlab = quote(Level ~ is ~ italic(M)) On 11/23/06, Philip Boland [EMAIL PROTECTED] wrote: Just wondering if it is possible to put something like The excess level is M in the xlab position of a plot but where the M is in

Re: [R] Problem with as.ts(zoo-object)

2006-11-23 Thread Gabor Grothendieck
Its a bug. Thanks. It will be fixed in the next version of zoo. In the meantime I will send you a fix offline. On 11/23/06, Albrecht, Dr. Stefan (AZ Private Equity Partner) [EMAIL PROTECTED] wrote: Dear all, I have an error message, when I try to convert a zoo object (called test) to ts (on

Re: [R] dumping/loading objects with 'tsp' attribute

2006-11-23 Thread Gabor Grothendieck
On 11/23/06, Antonio, Fabio Di Narzo [EMAIL PROTECTED] wrote: 2006/11/23, Prof Brian Ripley [EMAIL PROTECTED]: On Thu, 23 Nov 2006, Antonio, Fabio Di Narzo wrote: Dear all, I'm indirectly faced with the fact that setting the 'tsp' attribute of an object modifies its class definition:

Re: [R] dumping/loading objects with 'tsp' attribute

2006-11-23 Thread Gabor Grothendieck
On 11/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 11/23/06, Antonio, Fabio Di Narzo [EMAIL PROTECTED] wrote: 2006/11/23, Prof Brian Ripley [EMAIL PROTECTED]: On Thu, 23 Nov 2006, Antonio, Fabio Di Narzo wrote: Dear all, I'm indirectly faced with the fact that setting

Re: [R] Partial derivatives of a matrix with respect to a single element

2006-11-23 Thread Gabor Grothendieck
Try the Ryacas package: library(Ryacas) a - Sym(a); b - Sym(b); c - Sym(c); d - Sym(d) M - List(List(a*b, a*c), List(d, d)) deriv(M, a) expression(list(list(b, c), list(0, 0))) On 11/23/06, Ron E. VanNimwegen [EMAIL PROTECTED] wrote: UseRs, We are using projection matrices in demographic

Re: [R] Conversion from expression to numeric

2006-11-23 Thread Gabor Grothendieck
On 11/23/06, Paul Smith [EMAIL PROTECTED] wrote: On 23 Nov 2006 18:20:17 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote: I am trying to convert from the type expression to the type numeric. The following works: x - expression(6.2) as.numeric(as.character(x)) [1] 6.2

Re: [R] Conversion from expression to numeric

2006-11-23 Thread Gabor Grothendieck
Also note that Ryacas provides an Eval which has a yacas method that simplifies writing this: library(Ryacas) Eval(yacas(1/2)) See ?Eval On 11/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 11/23/06, Paul Smith [EMAIL PROTECTED] wrote: On 23 Nov 2006 18:20:17 +0100, Peter Dalgaard

Re: [R] Ryacas and fractions with simultaenously very large numerators and denominators

2006-11-23 Thread Gabor Grothendieck
There is likely some limitation in the Ryacas interface that needs to be addressed by the Ryacas developers. yacas itself can support very large numbers so just use yacas directly. Aside from that I, as mentioned previously in this thread, yacas returns a yacas object and that is a complex

Re: [R] Ryacas and fractions with simultaenously very large numerators and denominators

2006-11-23 Thread Gabor Grothendieck
the calculations are done on the yacas side: x - Sym(x) Set(x, 2/3) expression(2/3) for(i in 1:400) Set(x, x * 2/3) N(x) expression(2.440085918e-71) On 11/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: There is likely some limitation in the Ryacas interface that needs to be addressed

Re: [R] dataframe manipulation

2006-11-22 Thread Gabor Grothendieck
If x is the object at the end of your post: library(zoo) z - zoo(x$Freq, as.Date(x$Var1)) aggregate(z, as.yearmon, length) If out contains the result of aggregate then coredata(out) are the counts and time(out) are the corresponding year-months. See ?yearmon On 11/22/06, antonio rodriguez

Re: [R] data in form of a date

2006-11-22 Thread Gabor Grothendieck
Read the help desk article in R News 4/1. On 11/22/06, James J. Roper [EMAIL PROTECTED] wrote: Dear all, I often use dates and times in analyses. I just can't figure out how to format my date or time column in R. So, apparently R sees the date as something other than date (character).

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
, Paul Smith [EMAIL PROTECTED] wrote: On 11/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Checkout the INSTALLATION - UNIX and TROUBLESHOOTING sections of the home page: http://code.google.com/p/ryacas/ I have just installed the package Ryacas, but getting the following

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
in the first place. Also check which version of Ryacas you are using. On 11/19/06, Paul Smith [EMAIL PROTECTED] wrote: On 19 Nov 2006 16:11:52 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote: Paul Smith [EMAIL PROTECTED] writes: On 11/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
On 11/19/06, Paul Smith [EMAIL PROTECTED] wrote: On 11/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Sorry but there is not much else I can tell you. I don't have a UNIX system myself though I do know that others have used Ryacas on UNIX since the notes on the home page are based

Re: [R] The most common row in a matrix?

2006-11-19 Thread Gabor Grothendieck
Try this: a - matrix(1:3, 4, 5) a.ag - aggregate(1:nrow(a), as.data.frame(a), length) a.ag[which.max(a.ag$x), 1:ncol(a)] On 11/19/06, kone [EMAIL PROTECTED] wrote: Hi, How do you get the most common row from a matrix? If I have a matrix like this array(1:3,dim=c(4,5)) [,1] [,2]

Re: [R] Speeding up small functions

2006-11-19 Thread Gabor Grothendieck
Try a test in which you replace the function calls with inline code and compare the two speed-wise. You may very well find that the difference is inconsequential. On 11/19/06, Wee-Jin Goh [EMAIL PROTECTED] wrote: Greetings list, In my code, I have a few small functions that are called very

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
Thanks, Marc. I have placed a link to your post on the Ryacas home page. Also, Ryacas 0.2-3 is now on Omegahat (as well as google groups). On 11/19/06, Marc Schwartz [EMAIL PROTECTED] wrote: OK, after digging around for a couple of hours on this, thinking that this might be a

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
? On 11/19/06, Paul Smith [EMAIL PROTECTED] wrote: On 11/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Thanks, Marc. I have placed a link to your post on the Ryacas home page. Also, Ryacas 0.2-3 is now on Omegahat (as well as google groups). Apparently, the link HowTo - Enable Telnet

Re: [R] Ryacas not working properly

2006-11-19 Thread Gabor Grothendieck
I had an offline discussion with the Debian user and he indicated that the yacas invocation string was his problem and not telnet at all so I will remove that HowTo as it is indeed misleading. On 11/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: I don't have a UNIX box but my reading

Re: [R] deriv when one term is indexed

2006-11-18 Thread Gabor Grothendieck
Patched (2006-11-16 r39921) i386-apple-darwin8.8.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets [6] methods base other attached packages: MASS lattice 7.2-29 0.14-13 best, ken Gabor Grothendieck wrote: Please provide

Re: [R] deriv when one term is indexed

2006-11-18 Thread Gabor Grothendieck
r39722) On 11/18/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: This works for me in terms of giving results without error messages except for the confint(dd.plin) which I assume you don't really need anyways. gg - model.matrix(~ Gun/GL - Gun, dd) dd.plin - nls(Lum ~ gg^gamm, dd, start

Re: [R] Ryacas not working properly

2006-11-18 Thread Gabor Grothendieck
Checkout the INSTALLATION - UNIX and TROUBLESHOOTING sections of the home page: http://code.google.com/p/ryacas/ On 11/18/06, Paul Smith [EMAIL PROTECTED] wrote: Dear All I have just installed the package Ryacas, but getting the following: library(Ryacas) Loading required package: XML

Re: [R] questions on adding reference line?

2006-11-18 Thread Gabor Grothendieck
Try: axis(1, 0.5, tick = TRUE) On 11/18/06, zhijie zhang [EMAIL PROTECTED] wrote: Dear Ruser, I use abline() function to add the reference line successfully, but i can't display the values corresponding to the reference line on the x/y axis, anybody knows how to display it? *My simulated

Re: [R] Looking for greater floating-point precision

2006-11-17 Thread Gabor Grothendieck
On 11/17/06, Paul Smith [EMAIL PROTECTED] wrote: On 11/16/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: For my calculations, I am needing to use more floating-point precision than the default one of R. Is that possible? And, if yes, how? See package gmp (but that will be slow and

Re: [R] Looking for greater floating-point precision

2006-11-17 Thread Gabor Grothendieck
You might use the idea below together with sum.exact in the caTools package. On 11/17/06, Martin Maechler [EMAIL PROTECTED] wrote: Paul == Paul Smith [EMAIL PROTECTED] on Fri, 17 Nov 2006 12:12:52 + writes: Paul On 11/16/06, Prof Brian Ripley [EMAIL PROTECTED] Paul wrote:

Re: [R] do.call(+, ...)

2006-11-17 Thread Gabor Grothendieck
On 17 Nov 2006 15:59:24 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote: Robin Hankin [EMAIL PROTECTED] writes: On 17 Nov 2006, at 14:14, Peter Dalgaard wrote: [snip] so a+b+c is really (a+b)+c and I was calculating a+(b+c). That's actually a little bit harder because you don't

[R] which operators are available? (was: Re: do.call(+, ...))

2006-11-17 Thread Gabor Grothendieck
I did not realize that ++ was available. Is there a comprehensive list somewhere of which operators are available for definition? I searched the R Language manual for ++ but that only came up with a reference to C++ . On 17 Nov 2006 11:38:43 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote:

Re: [R] Numbers with correct significant digits

2006-11-17 Thread Gabor Grothendieck
Try this where vf is the output of your format statement: gsub([.]\\B, , vf) Actually I was surprised at this as my reading of ?regex suggests it should have been \\b but when that did not work I tried \\B and that did work.I am using R version 2.4.0 Patched (2006-10-24 r39722) on Windows

Re: [R] deriv when one term is indexed

2006-11-17 Thread Gabor Grothendieck
Please provide reproducible code which shows the error. dd - structure(list(Lum = c(0.15, 0.07, 0.1, 0.19, 0.4, 0.73, 1.2, + 1.85, 2.91, 3.74, 5.08, 6.43, 8.06, 9.84, 12, 14.2, 16.6, 0.1, + 0.1, 0.17, 0.46, 1.08, 2.22, 3.74, 5.79, 8.36, 11.6, 15.4, 19.9, + 24.6, 30.4, 36.1, 43, 49.9, 0.06, 0.06,

Re: [R] Lattice plots of the form xyplot(y1+y2~x)

2006-11-17 Thread Gabor Grothendieck
Use distribute.type = TRUE or panel = panel.superpose.2. as an argument to xyuplot. e.g. Using the builtin anscombe data set: xyplot(y1 + y2 ~ x1, anscombe, type = c(p, l), distribute.type = TRUE) # same xyplot(y1 + y2 ~ x1, anscombe, type = c(p, l), panel = panel.superpose.2) On

Re: [R] Numbers with correct significant digits

2006-11-17 Thread Gabor Grothendieck
You must be thinking of some other language: is.integer(1) [1] FALSE On 11/17/06, Andrew Robinson [EMAIL PROTECTED] wrote: Nice solution. I believe that showing the decimal point is correct. It demonstrates that the number is not an integer. Cheers Andrew On Fri, Nov 17, 2006 at

Re: [R] RBloomberg Package Problem

2006-11-16 Thread Gabor Grothendieck
Never used it but if you look down the check list on Windows: http://cran.r-project.org/bin/windows/contrib/checkSummaryWin.html for RBloomberg we see it has an error in attempting to access one of its dependent packages. See if building it yourself or going back to R 2.3.1 helps. On

Re: [R] modifying colnames of tables in a loop

2006-11-16 Thread Gabor Grothendieck
Try this: tb1 - tb2 - tb3 - matrix(1:100, 10, 10, dim = list(NULL, LETTERS[1:10])) head(tb1) lis - c(tb1, tb2, tb3) for(d in lis) colnames(.GlobalEnv[[d]]) - tolower(colnames(.GlobalEnv[[d]])) head(tb1) lis - list(tb1 = data.frame(1:100, 10, dim = list(NULL, LETTERS[1:10]), 3) lis -

Re: [R] trellis.par.set and grid : how to set by default that I want a grid on my graphes ?

2006-11-15 Thread Gabor Grothendieck
1. Another way to address this is to include g in the type vector: xyplot(Sepal.Length + Sepal.Width ~ Petal.Length , data = iris, allow.multiple = TRUE, scales = same, type = c(l, g)) 2. Also look in the example section of: library(zoo) ?xyplot.zoo which gives an example of plotting a

Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Gabor Grothendieck
Marc's solution looks a bit easier but here are a few more anyways: # 1 reshape(DF, dir = wide, timevar = Gender, idvar = Major) # 2 library(reshape) DFm - melt(DF, id = 1:2) cast(DFm, Major ~ Gender, fun = mean) On 11/15/06, Christian Convey [EMAIL PROTECTED] wrote: Thanks, let me try to

Re: [R] greatest common substring

2006-11-14 Thread Gabor Grothendieck
Try: V1 - c(Welfare_Group_1024, Welfare_Group_1536, Welfare_Group_160) V2 - c(xxxWelfare_Group_1024, yWelfare_Group_1536, zWelfare_Group_160) lcs - function(ff) { L - ff[1]; for(f in ff) L - lcs2(f,L); L } lcs(V1) lcs(V2) where lcs2 was posted here:

Re: [R] Error in str(its-object)

2006-11-14 Thread Gabor Grothendieck
A workaround if you need to multiply an its object by a number would be to convert the its object to zoo, do the multiply on the zoo object and then convert the resulting zoo object back to its. Using im from Martin's example: library(its) library(zoo) im as.its(3 * as.zoo(im)) On 11/14/06,

Re: [R] putting a column name on a zoo object

2006-11-14 Thread Gabor Grothendieck
First, read the last line of every message to r-help. The code below is not self contained nor reproducible. You can only put a column name on a zoo object that has columns! That means its data portion must be an nx1 matrix, not a vector. On 11/14/06, Leeds, Mark (IED) [EMAIL PROTECTED] wrote:

Re: [R] putting a column name on a zoo object

2006-11-14 Thread Gabor Grothendieck
Unfortunately that's wrong. Look at ?zoo . The first argument must be a numeric vector, matrix or factor. A data frame is not allowed. On 11/14/06, Horace Tso [EMAIL PROTECTED] wrote: Mark, it's not the most elegant solution but here it is, I have a zoo with a vector of numeric values,

Re: [R] not sure if this intended behavior in column referencing

2006-11-14 Thread Gabor Grothendieck
Please make your examples minimal. That includes not using huge variable names that make it harder to work with. This is not a zoo object with one column. Its is a zoo object based on a vector. zoo(matrix(1:3, 3, 1)) is not the same as zoo(1:3) The former has one column but the latter does

Re: [R] Can I execute the content of a character vector?

2006-11-13 Thread Gabor Grothendieck
On 11/13/06, Roger Bivand [EMAIL PROTECTED] wrote: On Mon, 13 Nov 2006, Luiz Rodrigo Tozzi wrote: Hi I want to know if there is any possibility of executing the content of a vector, for example: example=c(Test,1,0,0,0,seq(14,42,by=2),0,0,1) i want to know if there is anything

Re: [R] Question on applying vectors to data.frames by row

2006-11-13 Thread Gabor Grothendieck
Here are a couple of possibilities: as.data.frame(t(t(df) * vct)) df * rep(vct, each = nrow(df)) On 11/13/06, RDM [EMAIL PROTECTED] wrote: # Newbie alert # I am wanting to multiply the rows in a dataframe by a vector. # However, the default behavior appears to be for the vector to be

Re: [R] Computing time for matrix addition or subtraction

2006-11-12 Thread Gabor Grothendieck
This is slightly faster but not by much: ad - function(m, a) { diag(m) - diag(m) + a; m } R - ad(P %*% P - t(P) - P, 1) On 11/12/06, YONGWAN CHUN [EMAIL PROTECTED] wrote: Hello, I wonder by chance if there is a way to reduce computing time for matrix addition or subtraction. With a lot of

Re: [R] missing symbols for mathplot

2006-11-10 Thread Gabor Grothendieck
Try this: plot(0, main = quote(P(X ~ | ~ A ~ intersect(B On 11/10/06, stortignauz [EMAIL PROTECTED] wrote: Hi all, I'm trying to write an axis label that sounds P( X | K and Xb ) (probability of X given K and Xb ) but I need the intersection symbol (the \cap in latex) Actually I

Re: [R] axis command and excel time format

2006-11-09 Thread Gabor Grothendieck
You are using two different x's and one has nothing to do with the other. All of your examples are simply internally inconsistent so there is no reason to think they would work. On 11/9/06, Carmen Meier [EMAIL PROTECTED] wrote: Gabor Grothendieck schrieb: Please provide a complete self

Re: [R] Plotting symbols with two positions?

2006-11-09 Thread Gabor Grothendieck
Aside from the answers to use text you could use letters instead of numbers which would allow you to continue to use a single character and might have advantages in terms of saving space on the chart: pch = letters[trial_no] pch = c(letters, LETTERS)[trial_no] pch = c(1:9, letters,

Re: [R] Why do I get a linebreak in the legend?

2006-11-09 Thread Gabor Grothendieck
Try: legend(topleft, expression(R[adj]^2 == 0.66)) On 11/9/06, CG Pettersson [EMAIL PROTECTED] wrote: Dear all, W2k, R2.4.0 I want to place a legend in a regression plot, stating the adjusted R-square value. After some struggle with the coding I am nearly there, but only nearly. The best

Re: [R] axis command and excel time format

2006-11-08 Thread Gabor Grothendieck
Try this: plot(z, xaxt = n) xt - paste(23, seq(5, 50, 5), sep = :) axis(1, times(paste(xt, 0, sep = :)), xt) On 11/8/06, Carmen Meier [EMAIL PROTECTED] wrote: Hi to all, I have some problems to get the times-scale to the x-axis the times are coming from an excel sheet f. e [1] 0:01:00

Re: [R] Convert ordinary dates into POSIX

2006-11-08 Thread Gabor Grothendieck
There is a discussion and code in the R News 4/1 help desk article. On 11/8/06, Ivan Kalafatic [EMAIL PROTECTED] wrote: Does anyone know where I can find any tool for Windows that converts dates from ordinary formats into POSIX? I need it to import sime time series from Excel into R and use

<    2   3   4   5   6   7   8   9   10   11   >