Re: [R] what's going on here with substitute() ?

2003-10-24 Thread Tony Plate
- this.is.R identical(f, eval(parse(text=attr(f, source))[[1]])) [1] FALSE f - function() TRUE identical(f, eval(parse(text=attr(f, source))[[1]])) [1] TRUE -- Tony Plate At Thursday 09:12 PM 10/23/2003 +0200, Peter Dalgaard wrote: Tony Plate [EMAIL PROTECTED] writes: Why is the body

RE: [R] Weird problem with median on a factor

2003-10-31 Thread Tony Plate
median() has this test in it: if (mode(x) != numeric) stop(need numeric data) Note the following: is.numeric(factor(letters)) [1] FALSE mode(factor(letters)) [1] numeric It seems as though median() is using the wrong test. -- Tony Plate At Friday 03:37 PM 10/31/2003 -0500, [EMAIL

Re: [R] Plotting lm() attributes

2003-11-12 Thread Tony Plate
). Also, note that this technique produces a NA fitted value where a non-NA one could be produced (use predict(m, newdata=data) to get those values.) hope this helps, Tony Plate At Thursday 11:40 AM 11/13/2003 +1300, Murray Jorgensen wrote: Suppose you fit a linear model model.1 ~ lm(v1

Re: [R] Fitting to strange function

2003-11-13 Thread Tony Plate
Is there some reason that the simple obvious does not work or is in some way not adequate? data - data.frame(x=c(1:5), y=c(1,3,2,NA,4)) nls(y ~ A*x^2 +sqrt(0.08*A)*x, data=data, start=list(A=0)) Nonlinear regression model model: y ~ A * x^2 + sqrt(0.08 * A) * x data: data A

Re: [R] LOCF - Last Observation Carried Forward

2003-11-17 Thread Tony Plate
)) + } x - sample(c(T,F),1e7,rep=T) system.time(most.recent.cut(x)) [1] 41.21 0.54 41.98NANA system.time(most.recent(x)) [1] 2.67 0.08 2.78 NA NA -- Tony Plate At Friday 10:21 PM 11/14/2003 -0500, Gabor Grothendieck wrote: From: Tony Plate [EMAIL PROTECTED]: Here's a function

Re: [R] sampling without repetition

2003-11-17 Thread Tony Plate
__ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Tony Plate [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] add a point to regression line and cook's distance

2003-12-04 Thread Tony Plate
). hope this helps, Tony Plate At Wednesday 02:31 PM 12/3/2003 -0800, [EMAIL PROTECTED] wrote: Hi, This is more a statistics question rather than R question. But I thought people on this list may have some pointers. MY question is like the following: I would like to have a robust regression

Re: [R] s-plus to R

2003-12-05 Thread Tony Plate
this helps, Tony Plate At Friday 04:33 PM 12/5/2003 +, Ognen Duzlevski wrote: Hi, I have a piece of code originally written for s-plus - I am trying to run it in R now. The code was obtained from someone who is now not available to give any pointers and I am a beginner in R. Here is where

Re: [R] beginner programming question

2003-12-17 Thread Tony Plate
34 hope this helps, Tony Plate PS. To advanced R users: Is the above usage of the colnames- function within an expression regarded as acceptable or as undesirable programming style? -- I've rarely seen it used, but it can be quite useful. At Wednesday 09:28 PM 12/17/2003 +0200, Adrian Dusa

Re: [R] beginner programming question

2003-12-17 Thread Tony Plate
Thanks. As a follow-up question, is it considered acceptable programming practice for - functions to modify their x argument? -- Tony Plate At Thursday 12:23 AM 12/18/2003 +0100, Peter Dalgaard wrote: Tony Plate [EMAIL PROTECTED] writes: xx - rbind(colnames-(x[,c(rel1,age0,age1,sex0,sex1

RE: [R] mailing list for basic questions - preliminary sum up

2003-12-17 Thread Tony Plate
, people told that they should have contacted the package maintainer first.) -- Tony Plate At Wednesday 07:26 PM 12/17/2003 -0500, Liaw, Andy wrote: From: Tom Mulholland I have empathy for lots of the points already made, more often on the life is not always easy and you have to work

Re: [R] SORTING Arrays by index value

2003-02-04 Thread Tony Plate
()) -- Tony Plate At Tuesday 11:46 AM 2/4/2003 -0500, Mark G Orr wrote: Hello, I'm somewhat new to R. I've searched the archive for the last year and tried to consult the manual pages for the following problem, but did not find an answer. I want to sort an array by the index values. Here

Re: [R] Formatting significant digits with trailing zeros

2003-03-14 Thread Tony Plate
Does this do what you want? x - c(2.503,2.477,0.1204) sapply(signif(x,3), sprintf, fmt=%#.3g) [1] 2.50 2.48 0.120 This will give you scientific notation for very large or small numbers. At Friday 02:17 PM 3/14/2003 -0800, Don MacQueen wrote: I need a function like signif(), but returns

Re: [R] Is it a bug in list() behavior?

2003-03-24 Thread Tony Plate
As wolski/Eryk's example shows, it seems that [[ for lists accepts abbreviations, whereas [ does not. Is this intended? (This is a difference from S-plus - both [ and [[ for lists accept abbreviations in S-plus (V6.1 for Windows at least.) I couldn't find any mention of this difference in

Re: [R] Is it a bug in list() behavior?

2003-03-24 Thread Tony Plate
At Monday 07:31 PM 3/24/2003 +0100, Uwe Ligges wrote: Tony Plate wrote: As wolski/Eryk's example shows, it seems that [[ for lists accepts abbreviations, whereas [ does not. Is this intended? (This is a difference from S-plus - both [ and [[ for lists accept abbreviations in S-plus (V6.1

Re: [R] Help with data.frame subsets

2003-03-25 Thread Tony Plate
The [ operator also takes a drop= argument (type ?[ to see the help page and find details.) So you can do what you want in a single step, as follows: subData - dataFrame[dataFrame[,2]=Min dataFrame[,2]=Max, , drop=F] [If your dataFrame object really is a data.frame, the drop=F shouldn't be

Re: [R] Combining the components of a character vector

2003-04-04 Thread Tony Plate
From ?paste: If a value is specified for `collapse', the values in the result are then concatenated into a single string, with the elements being separated by the value of `collapse'. paste(c(Bob, loves, Sally), collapse= ) [1] Bob loves Sally At Wednesday 03:54 PM 4/2/2003 -0800,

Re: [R] Multiple match function?

2003-06-11 Thread Tony Plate
At Wednesday 03:28 AM 6/11/2003 +0200, Jonck van der Kogel wrote: Hi all, I have (yet another) question about a function in R. What I would like to do is test for the presence of a certain value in a vector, and have the positions that this value is at returned to me. For example, let's say I

Re: [R] ordering of alphanumeric strings

2003-07-10 Thread Tony Plate
). hope this helps, Tony Plate At Thursday 04:37 PM 7/10/2003 -0400, kschlauc wrote: Can someone tell me which version of R began to order alpha-numeric strings in this manner: ABC 10 ABC 2 rather than ABC 2 ABC 10 ? And, is there a way to force ABC 2 to be ordered as a value less than ABC 10? thank

Re: [R] confused about histograms

2003-07-17 Thread Tony Plate
hist(sample(0:3, 10, T), breaks=(0:4)-0.5) At Thursday 02:32 PM 7/17/2003 -0700, Jay Pfaffman wrote: I've got a data set with integer codes from 0--3. I'd like a histogram with a single bar for 0, 1, 2 and 3. I'd like each of the 4 bars centered over a label. hist(mydata, breaks=4,

Re: [R] Contents of R-help digest.-contouring

2003-07-21 Thread Tony Plate
that the x and y elements have different lengths, to provide a quick check that the x and y dimensions were not swapped somewhere along the way. hope this helps, Tony Plate At Monday 01:45 PM 7/21/2003 -0400, john lewis wrote: R- Users: Can someone indicate what I am during wrong

Re: [R] data manipulation: getting mean value every 5 rows

2003-07-28 Thread Tony Plate
] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Tony Plate [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] mclust - clustering by spatial patterns

2003-12-18 Thread Tony Plate
giving the probability of each presence matrix being generated for each component of the mixture model, but I don't know how hard it would be implement the EM search for an appropriate mixture model.) -- Tony Plate At Thursday 08:55 PM 12/18/2003 +, Jarrod Hadfield wrote: Dear All, I have

[R] draft of posting guide

2003-12-19 Thread Tony Plate
guidelines on what to post and how to post in a way that maximizes your chances of getting useful answers, please read the posting guide... -- Tony Plate __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

[R] revision of posting guide

2003-12-23 Thread Tony Plate
guide before posting here. Several correspondents liked this idea. Is this desirable and/or doable? thanks for all the assistance, Tony Plate __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

RE: [R] draft of posting guide

2003-12-23 Thread Tony Plate
to a package that is downloaded from CRAN try contacting the package maintainers first. Comments welcome, however, at this point, perhaps it would be better to send comments to me privately, as most people have probably had enough of this discussion. cheers, Tony Plate PS. There is a slightly

Re: [R] Constructing a lm for predict() by hand

2004-01-06 Thread Tony Plate
) %*% coef where data is n x k matrix, coef is a vector of length k+1, and the intercept is the first element of coef. hope this helps, Tony Plate At Tuesday 10:04 AM 1/6/2004 -0500, Alexander Wise wrote: Hello, this probably seems like an odd question, but... If I have the formula and the coefficients

Re: [R] comparing classification methods: 10-fold cv or leaving-one-out ?

2004-01-06 Thread Tony Plate
misspecification). However, because the issues are subtle, it is easy to get results that appear significant... hope this helps, Tony Plate At Tuesday 04:31 PM 1/6/2004 +0100, Christoph Lehmann wrote: Hi what would you recommend to compare classification methods such as LDA, classification trees

Re: [R] Problem while reading .csv files

2004-01-06 Thread Tony Plate
is that you can cut and paste from script files in order to try to track down errors. Did you try that with the QQQ- line? (It looks fine to me, and this works for me to read .csv files.) -- Tony Plate At Tuesday 11:46 AM 1/6/2004 -0500, Ashutosh Tayshete wrote: I have this line at the start of my

Re: [R] Fit non-linear regressor

2004-01-08 Thread Tony Plate
, MD, MSc National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Tony Plate

Re: [R] Fit non-linear regressor

2004-01-09 Thread Tony Plate
might want to check that your objective does not have local optima (in which case the assumption that minimizing the sum-squared residual will minimize your objective may be false). hope this helps, Tony Plate At Friday 04:35 PM 1/9/2004 -0200, Bernardo Rangel Tura wrote: Hi R masters, Sorry

Re: [R] array(list(),c(2,5)) gives error in R 1.8.1

2004-01-14 Thread Tony Plate
array() a data value of the correct length: array(list()[1:4], c(2,2)) [,1] [,2] [1,] NULL NULL [2,] NULL NULL -- Tony Plate At Wednesday 10:35 AM 1/14/2004 +0100, you wrote: Hi In R 1.7 the following worked fine: array(list(),c(2,5)) [,1] [,2] [,3] [,4] [,5] [1,] NULL NULL NULL NULL

Re: [R] Read In and Output Postscript file

2004-01-28 Thread Tony Plate
generate multiple single-page postscript files, and then use gs to wrap them up in a pdf). hope this helps, Tony Plate At Wednesday 02:19 PM 1/28/2004 -0600, Brad Holmes wrote: Hi, I am only a few months old at R and I have encountered an interesting issue. Would it be possible to read in a pre

Re: [R] Adding data.frames together

2004-03-09 Thread Tony Plate
a 2 2 b 3 3 c 11 4 d 21 5 e -- Tony Plate At Tuesday 05:00 PM 3/9/2004, Tom Blackwell wrote: John - The function rbind() operates on pairs of data frames, and (somewhat arcane and definitely NOT for beginning users) do.call(rbind, list(df1, df2, df3, df4, df5))) will combine any number

Re: [R] do.call and environments

2004-03-10 Thread Tony Plate
(i.e., trial and error), so they may not be particularly good or elegant. However, I'm sure that others will point out both any problems with these suggestions and some better solutions! hope this helps, Tony Plate At Wednesday 09:05 AM 3/10/2004, Thomas Petzoldt wrote: Hello, I want to call

Re: [R] how to pass extra parameters using call() or similar mechanism ?

2004-03-11 Thread Tony Plate
If you want to use call() with a list of arguments, the easiest way I know of is to use do.call() (if anyone knows a better way, please say so!) myfun2 - function(method, x, ...) { +method.call - do.call(call, list(method, x, ...)) +eval(method.call) + } myfun2('sqrt',2) [1] 1.414214

RE: [R] substitute question

2004-03-18 Thread Tony Plate
) attributes(ze) $source [1] function(){a+1} attr(ze, source) - NULL ze function () { b + 1 } I previously wrote on this topic: Date: Fri, 24 Oct 2003 09:42:55 -0600 To: [EMAIL PROTECTED], Peter Dalgaard [EMAIL PROTECTED] From: Tony Plate [EMAIL PROTECTED] Subject: Re: [R] what's going on here

RE: [R] substitute question

2004-03-18 Thread Tony Plate
() { a + 1 }, list(a = quote(b))) eval(z) function() { b + 1 } eval(eval(z)) # this displays the source attribute function(){a+1} body(eval(eval(z))) { b + 1 } hope this helps, Tony Plate At Thursday 12:00 PM 3/18/2004, you wrote: Tony, Thomas. Thanks for your help. Your comments were

Re: [R] substitute question

2004-03-18 Thread Tony Plate
()) (but I haven't carefully reasoned through this being an explanation for your particular frustration here.) hope this might help, Tony Plate At Thursday 04:06 PM 3/18/2004, Gabor Grothendieck wrote: Date: 18 Mar 2004 23:52:47 +0100 From: Peter Dalgaard [EMAIL PROTECTED] To: [EMAIL

[R] [R-pkgs] new version of abind()

2004-03-22 Thread Tony Plate
when requested, not by default. * R/adrop.R man/adrop.Rd added new function adrop(). This is a function like drop(), but it allows to user to specify which of the dimensions with extent one will be dropped. Please let me know of any problems. -- Tony Plate Tony

Re: [R] Zero Index Origin?

2004-04-01 Thread Tony Plate
before multiplying and then add one back in at the end. However, this really was a minor inconvenience, and if I wanted I could have written a function to do my index computations for me. What other more significant computations are so much easier with zero-based indexing? -- Tony Plate

Re: [R] More user-friendly error message needed.

2004-04-07 Thread Tony Plate
cryptic error messages. -- Tony Plate At Wednesday 01:07 PM 4/7/2004, Shin wrote: When I tried the following commands, I got a strange message. x-data.frame(y=c(1:10)) plot(x$z) Error in xy.coords(x, y, xlabel, ylabel, log) : x and y lengths differ The data frame, x, does not have a field

Re: [R] Line numbers in error messages

2004-04-12 Thread Tony Plate
in the function code.) If line info was printed out only when source was saved in the source attribute, this could still be useful. -- Tony Plate At Monday 05:41 PM 4/12/2004, Duncan Murdoch wrote: On Mon, 12 Apr 2004 15:20:58 -0700, you wrote: Hi Patrick, It's very simple using a browser() line in your

Re: [R] t.test formatting question

2004-04-16 Thread Tony Plate
as.numeric() (and its siblings) strip the names from vectors, e.g.: as.numeric(t.test(rnorm(1001))$statistic) [1] -0.6320304 hth, Tony Plate At Friday 05:14 PM 4/16/2004, christopher ciotti wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello all - I'm trying to format some data where

Re: [R] outer-question

2005-10-27 Thread Tony Plate
(X=a, Y=b, FUN=f, d=additional) In f: 12 12 [,1] [,2] [,3] [,4] [1,] 53.61985 54.61985 55.61985 56.61985 [2,] 54.61985 56.61985 58.61985 60.61985 [3,] 55.61985 58.61985 61.61985 64.61985 Note that f is called only once, with vectors for a and b. -- Tony Plate Rau, Roland

Re: [R] Still a bug with NA in sd() or var()?

2005-10-31 Thread Tony Plate
are passing essentially a random value. By luck, in your example, the first element was T, which is why you got a value of 1.707825 as the result, and not NA. The rest might fall into place when this understanding is cleared up. -- Tony Plate __ R-help

Re: [R] R and databases - a comment

2005-12-09 Thread Tony Plate
This is very useful, thanks for posting! I created a page for this at the R Wiki: http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?DataBases If any one has any info to add, go at it! -- Tony Plate charles loboz wrote: 1. That was a part of a private email exchange. It has been suggested

[R] update to posting guide: use 'sessionInfo()' instead of 'version'

2005-12-29 Thread Tony Plate
does not report all the information that 'version' does (it omits at least Status and svn rev). R-core members are aware of this -- whether or not they change this is up to them.] -- Tony Plate __ R-help@stat.math.ethz.ch mailing list https

Re: [R] Wikis etc.

2006-01-06 Thread Tony Plate
momentum? -- Tony Plate Frank E Harrell Jr wrote: I feel that as long as people continue to provide help on r-help wikis will not be successful. I think we need to move to a central wiki or discussion board and to move away from e-mail. People are extremely helpful but e-mail seems

Re: [R] Correct way to test for exact dimensions of matrix or array

2006-01-10 Thread Tony Plate
There's a gotcha in using identical() to compare dimensions -- it also compares names, e.g.: x - array(1:14, dim=c(rows=3,cols=5)) dim(x) rows cols 35 identical(dim(x)+0, c(3,5)) [1] FALSE identical(as.numeric(dim(x)+0), c(3,5)) [1] TRUE Gabor Grothendieck wrote: If its just

Re: [R] Convert matrix to data.frame

2006-01-12 Thread Tony Plate
it didn't work for you? (e.g., show the exact error message). -- Tony Plate Chia, Yen Lin wrote: Hi all, I wonder how could I convert a matrix A to a dataframe such that whenever I'm running a linear model such lme, I can use A$x1? I tried data.frame(A), it didn't work. Should I initialize

Re: [R] for loop should check the looping index !!

2006-01-13 Thread Tony Plate
(2, len=length(x)-1) or seq(along=x)[-1]. -- Tony Plate johan Faux wrote: Hello , a-c(1) for(i in 2:length(a)) do.something with a[[i]] I get : Error in a[[i]] : subscript out of bounds Am I missing something here? Doesnt R check the value of i inside

Re: [R] not understanding a do.call

2006-10-18 Thread Tony Plate
- list(a=a,b=b) x2 - list(a=a,b=b,c=c) do.call(cbind, x1) a b [1,] 1 4 [2,] 2 5 [3,] 3 6 do.call(cbind, x2) a b c [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 -- Tony Plate Leeds, Mark (IED) wrote: I did a ?do.call but i don't think i understand it. if a, b,c,d are numeric vectors

Re: [R] problem about using list element in for cycle

2006-10-23 Thread Tony Plate
Your problem is that you are using cat() on a factor. Use as.character() or format() to convert the factor to character data, which cat will then print in the way you want. x - data.frame(L=letters[1:3]) x L 1 a 2 b 3 c x$L [1] a b c Levels: a b c cat(x$L, \n) 1 2 3

Re: [R] data storage/cubes and pointers in R

2006-11-09 Thread Tony Plate
together vectors and arrays into higher dimensional arrays -- it might come in handy for you. -- Tony Plate Piet van Remortel wrote: Hi all, I am faced with the situation where I want to store/analyze relatively large, organized sets of numerical data, which depend on a number

Re: [R] Nonlinear statistical modeling -- a comparison of R and AD Model Builder

2006-11-24 Thread Tony Plate
you try using that optimization routine with this problem? -- Tony Plate dave fournier wrote: There has recently been some discussion on the list about AD Model builder and the suitability of R for constructing the types of models used in fisheries management. https://stat.ethz.ch

Re: [R] ifelse question

2006-12-12 Thread Tony Plate
, 11:14) -- Tony Plate Jacques Ropers wrote: But you got only two (eventually one) distinct values, right? Look at the code for 'ifelse': yes and no are only called once each, then recycled to desired length. I guess you want something like x - rnorm(10) y - rnorm(10) z - rnorm(10) y1 - ifelse(x

Re: [R] How to avoid test for NAs in foreign function call

2006-12-14 Thread Tony Plate
unwanted interpretations of certain bit patterns. -- Tony Plate Knut M. Wittkowski wrote: We have packed logical vectors into integers, 32 flags at a time and then want to AND or OR these vectors of integers using other C functions. The problem: occasionally, the packed sequence of 32 logical

Re: [R] Simple Date problems with cbind

2007-01-30 Thread Tony Plate
date 1 1 2005-01-24 2 2 2006-01-23 3 3 2006-01-23 class(x) [1] data.frame sapply(x, class) int date integerDate -- Tony Plate __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Outlook does threading

2007-01-31 Thread Tony Plate
By-Conversation. Hope this helps (in case the horse was not thoroughly dead already.) -- Tony Plate Kimpel, Mark William wrote: See below for Bert Gunter's off list reply to me (which I do appreciate). I'm putting it back on the list because it seems there is still confusion regarding

Re: [R] indexing

2007-02-01 Thread Tony Plate
a - data.frame(value=c(6.5,7.5,8.5,12.0),class=c(1,3,5,2)) x - c(1,1,2,7,6,5,4,3,2,2,2) match(x, a$class) [1] 1 1 4 NA NA 3 NA 2 4 4 4 a[match(x, a$class), value] [1] 6.5 6.5 12.0 NA NA 8.5 NA 7.5 12.0 12.0 12.0 -- Tony Plate javier garcia-pintado wrote: Hello

Re: [R] How to print a double quote

2007-02-22 Thread Tony Plate
cat('Open fnd test\n') Open fnd test cat(Open fnd \test\\n) Open fnd test Bos, Roger wrote: Can anyone tell me how to get R to include a double quote in the middle of a character string? For example, the following code is close: fnd-Open fnd 'test' cat(fnd) Open fnd

Re: [R] optim(method=L-BFGS-B) abnormal termination

2007-02-23 Thread Tony Plate
-behaved function. It may be possible to increase the number of steps, but I don't see how from the docs for ?optim. Of course, the source is available. hope this helps, Tony Plate Petr Klasterecky wrote: Hi, my call of optim() with the L-BFGS-B method ended with the following error message

Re: [R] timeDate business day

2007-03-13 Thread Tony Plate
States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base other attached packages: fCalendar fEcofin 240.10068 240.10067 Sys.getenv(TZ) TZ -- Tony Plate Michael Toews wrote: Those numbers look like ... well, numbers. You want

Re: [R] timeDate business day

2007-03-13 Thread Tony Plate
’timeDate’ and ’timeSeries’ Classes for R, Diethelm W¨urtz http://www.itp.phys.ethz.ch/econophysics/R/pdf/calendar.pdf -- Tony Plate Michael Toews wrote: Sadly, I don't know of any tutorials or much help on the web for R ... that doesn't mean it doesn't exist ... you might just have to look around

Re: [R] data.frame handling

2007-03-19 Thread Tony Plate
columns in a data frame, then just do table(X$factor1, X$factor2) hope this helps, Tony Plate Michela Cameletti wrote: Dear R-users, I have a little problem that I can't solve by myself. I have a data frame with 2 factors and 8 observations (see the following code): y - c

Re: [R] Prefered date and date/time classes

2007-03-27 Thread Tony Plate
on the Wiki, please go ahead!) -- Tony Plate Petr Pikal wrote: Hi On 27 Mar 2007 at 9:09, Charles Dupont wrote: Date sent:Tue, 27 Mar 2007 09:09:27 -0500 From: Charles Dupont [EMAIL PROTECTED] Organization: Vanderbilt University; Department

Re: [R] Replacement in an expression - can't use parse()

2007-03-27 Thread Tony Plate
Peter Dalgaard wrote: Daniel Berg wrote: Dear all, Suppose I have a very long expression e. Lets assume, for simplicity, that it is e = expression(u1+u2+u3) Now I wish to replace u2 with x and u3 with 1. I.e. the 'new' expression, after replacement, should be: e

Re: [R] Fastest way to repeatedly subset a data frame?

2007-04-20 Thread Tony Plate
Here's some timings on seemingly minor variations of data structure showing timings ranging by a factor of 100 (factor of 3 if the worst is omitted). One of the keys is to avoid use of the partial string match that happens with ordinary data frame subscripting. -- Tony Plate n - 1

Re: [R] Fastest way to repeatedly subset a data frame?

2007-04-20 Thread Tony Plate
to know for myself what sort of speed differences there was now among the various approaches. -- Tony Plate Iestyn Lewis wrote: This is fantastic. I just tested the first match() method and it is acceptably fast. I'll look into some of the even better methods later. Thank you for taking

Re: [R] Handling of arrays

2007-04-24 Thread Tony Plate
Try the following and look at what they return: str(ca) dimnames(ca) -- Tony Plate [EMAIL PROTECTED] wrote: Dear R-Experts, I just imported a workspace from Matlab. I know that I can get the names of the imported variables with names(). It works. The variable ca consists of several

Re: [R] intersect more than two sets

2007-04-24 Thread Tony Plate
I don't think there's that sort of apply-reduce function in R, but for this problem, the last line below happens to be a one-liner: set.seed(1) x - lapply(1:10, function(i) sample(letters, 20)) table(unlist(x)) a b c d e f g h i j k l m n o p q r s t u v w x y

Re: [R] regular expressions with grep() and negative indexing

2007-04-25 Thread Tony Plate
I use regexpr() instead of grep() in cases like this, e.g.: x2[regexpr(exclude,x2)==-1] (regexpr returns a vector of the same length as character vector given it, so there's no problem with it returning a zero length vector) -- Tony Plate Peter Dalgaard wrote: Stephen Tucker wrote: Dear R

Re: [R] applying rbind to list elements

2007-04-25 Thread Tony Plate
do.call(rbind, l) or, in the case of matrices, using the abind package: abind(l, along=1) library(abind) l - list(matrix(1:6, ncol=2), matrix(11:14, ncol=2)) abind(l, along=1) [,1] [,2] [1,]14 [2,]25 [3,]36 [4,] 11 13 [5,] 12 14 Hendrik Fuß wrote:

[R] [R-pkgs] new package: RSVGTipsDevice: create SVG plots with tooltips hyperlinks

2007-05-03 Thread Tony Plate
the DESCRIPTION file: Package: RSVGTipsDevice Version: 0.7.0 Date:04/30/2007 Title: An R SVG graphics device with dynamic tips and hyperlinks Author: Tony Plate [EMAIL PROTECTED], based on RSvgDevice by T Jake Luciani [EMAIL PROTECTED] Maintainer: Tony Plate [EMAIL PROTECTED] Depends: R

[R] getting informative error messages

2007-05-07 Thread Tony Plate
in this type of situation? I couldn't find any help in the section Debugging R Code in R-exts (or anything at all relevant in R-intro). (Different values for options(error=...) and different formatting of the function made no difference.) -- Tony Plate sessionInfo() R version 2.5.0 (2007-04-23

Re: [R] getting informative error messages

2007-05-11 Thread Tony Plate
, and on developer.r-project.org but was unable to find clear guidance there either. -- Tony Plate On Mon, 7 May 2007, Tony Plate wrote: Certain errors seem to generate messages that are less informative than most -- they just tell you which function an error happened in, but don't indicate

Re: [R] R2 always increases as variables are added?

2007-05-24 Thread Tony Plate
(assuming model has intercept) computations for R^2: SSE - sum((y.hat - data$y)^2) SST - sum((data$y - mean(data$y))^2) SSR - sum((y.hat - mean(data$y))^2) 1 - SSE/SST [1] 0.6427161 SSR/SST [1] 0.6427161 hope this helps, Tony Plate Disclaimer: I too do not have any degrees in statistics

Re: [R] Interactive plots?

2007-05-25 Thread Tony Plate
The package RSVGTipsDevice allows you to do just it just -- you create a plot in an SVG file that can be viewed in a browser like FireFox, and the points (or shapes) in that plot can have pop-up tooltips. -- Tony Plate mister_bluesman wrote: Hi there. I have a matrix that provides place

Re: [R] how to find how many modes in 2 dimensions case

2007-06-09 Thread Tony Plate
does not include diagonal neighbors). And of course, ties make things more complicated (note that the above simple algorithm misses the local maximum consisting of two 8's in the last row.) -- Tony Plate Patrick Wang wrote: Hi, Does anyone know how to count the number of modes in 2

Re: [R] Problem with RSVGTipsDevice

2007-06-18 Thread Tony Plate
The new version of RSVGTipsDevice (0.7.1) that is now available on CRAN should fix this problem. Please let me know if it doesn't, or if there are other problems. -- Tony Plate mister_bluesman wrote: Hi there. I am still trying to get the RSVGTipsDevice to work, yet I can not. I have

Re: [R] poor rbind performance

2007-07-18 Thread Tony Plate
expressions can be composed into a single expression if you want) -- Tony Plate Aydemir, Zava (FID) wrote: Hi I rbind data frames in a loop in a cumulative way and the performance detriorates very quickly. My code looks like this: for( k in 1:N) { filename - paste(/tmp/myData_

Re: [R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Tony Plate
One simple way that I haven't seen mentioned yet is to do: get(a)$x (which of course allows further variants such as get(a)$x[3:6] ...) -- Tony Plate Juan Manuel Barreneche wrote: my problem can be explained with the following example: x - 1:12 y - 13:24 a - data.frame(x = x, y = y

Re: [R] Q: selecting a name when it is known as a string

2007-09-04 Thread Tony Plate
of Observations: 20 Equivalent Number of Parameters: 4.87 Residual Standard Error: 1.179 hope this helps, Tony Plate D. R. Evans wrote: I am 100% certain that there is an easy way to do this, but after experimenting off and on for a couple of days, and searching everywhere I could think of, I haven't

Re: [R] Q: selecting a name when it is known as a string

2007-09-05 Thread Tony Plate
1 2 52 2 63 2 -- Tony Plate D. R. Evans wrote: D. R. Evans said the following at 09/04/2007 04:14 PM : I am 100% certain that there is an easy way to do this, but after I have reconsidered this and now believe it to be essentially impossible (or at the very least

[R] [R-pkgs] new package 'trackObjs' - mirror objects to files, provide summaries modification times

2007-09-10 Thread Tony Plate
result from resource limitiations, e.g., being unable to write a save file due to lack of disk space, or from manual tinkering, e.g., dropping a new save file into a tracking directory.) [truncated here -- see ?trackObjs] -- Tony Plate PS: to give credit where due, the end

<    1   2