Re: [R] Geometric progression

2008-02-24 Thread Charilaos Skiadas
On Feb 24, 2008, at 9:36 PM, Andre Nathan wrote: On Sun, 2008-02-24 at 23:26 -0300, Andre Nathan wrote: gp(1, 2, 10) [1]1248 16 32 64 128 256 512 1024 Actually, [1]1248 16 32 64 128 256 512 2^(0:9) Andre Haris Skiadas Department of

Re: [R] remove column names from a data frame

2008-02-18 Thread Charilaos Skiadas
I can't resist asking, why would you want to remove the variable names? If it is for printing purposes, then you can probably work around it on the printing side, depending on what you want to print. I can't think of another reason for wanting to remove the column names altogether. Haris

Re: [R] write output in a custom format

2008-02-15 Thread Charilaos Skiadas
Perhaps I am missing the obvious, but can't you simply write a small function that, given each particle object, returns a string with the required output format (probably a couple of paste calls with sep and collapse set), and then use sapply and this function on the list of particles to

Re: [R] fun.aggregate=mean in reshape

2008-02-12 Thread Charilaos Skiadas
On Feb 12, 2008, at 1:31 PM, [Ricardo Rodriguez] Your XEN ICT Team wrote: Sundar Dorai-Raj wrote: Could it we advisable that cast, melt or whatever function we deal with throws an more informative error message when this kind of conflicts occur? I am guessing this is a pretty frequent

Re: [R] matching last argument in function

2008-02-12 Thread Charilaos Skiadas
On Feb 12, 2008, at 3:31 PM, Thomas Lumley wrote: On Tue, 12 Feb 2008, Alistair Gee wrote: I often want to temporarily modify the options() options, e.g. a - seq(1001, 1001 + 10) # some wide object with.options - function(..., expr) { options0 - options(...) tryCatch(expr,

Re: [R] R on Mac PRO does anyone have experience with R on such a platform ?

2008-02-11 Thread Charilaos Skiadas
JiHO, in case you are not following TextMate's mailing list, you might want to check out Hans-Jorg Bibiko's work on Rdaemon: http://article.gmane.org/gmane.editors.textmate.general/24195/ It provides a lot of the terminal functionality within a TextMate window, uses X11 for the plots, and

Re: [R] How to search for packages - wrap up!

2008-02-06 Thread Charilaos Skiadas
On Feb 6, 2008, at 6:23 AM, Neil Shephard wrote: Charilaos Skiadas-3 wrote: On Feb 5, 2008, at 10:37 AM, Monica Pisica wrote: But perhaps I am missing something very obvious? I thought the task views were located where they are (linked from the page that lists packages

Re: [R] How to search for packages - wrap up!

2008-02-05 Thread Charilaos Skiadas
On Feb 5, 2008, at 10:37 AM, Monica Pisica wrote: Hi everybody, I have to recognize that my post certainly shows my lack of skills in really navigating the R web page i am surprised that only one or two persons wrote me about the Task Views - it is what i was after - although

Re: [R] non-plot plotting

2008-01-17 Thread Charilaos Skiadas
On Jan 17, 2008, at 9:44 AM, Johannes Graumann wrote: I really do not know ho to else title this ... I want to draw something like the attached png with R and would like to poll you on how to start ... make an empty plot first and then start positioning the characterstring by 'text'

Re: [R] is it safe to replace every - by = in R code?

2008-01-13 Thread Charilaos Skiadas
And of course let's not forget that a particularly twisted individual could overwrite =: `=` - function(x,y) print(x+y) 3 = 4 [1] 7 3 - 4 Error in 3 - 4 : invalid (do_set) left-hand side to assignment I also was for a while mystified by the - assignment, and preferred = instead, but

Re: [R] using sub with wildcards, e.g. sub(\\*.., , test.a..34)

2008-01-08 Thread Charilaos Skiadas
If this is really the case you are dealing with, wouldn't strsplit do the job more easily? On Jan 8, 2008, at 5:47 PM, Thomas Pujol wrote: I have a text string test.a..34 I wish to extract the text that comes after .. (e.g. 34), and the text that comes before .. (e.g. test.a). What

Re: [R] Avoiding FOR loops

2008-01-06 Thread Charilaos Skiadas
On Jan 6, 2008, at 7:55 PM, dxc13 wrote: useR's, I would like to know if there is a way to avoid using FOR loops to perform the below calculation. Consider the following data: snip Here, X is a matrix of 3 variables in which each is of size 5 and XK are some values that correspond

Re: [R] Suggestion on how to make permanent changes to a single object in a list?

2008-01-03 Thread Charilaos Skiadas
You might want to consider using the proto package. Otherwise, functions that end in - have the ability to alter their arguments. Look at the following (admittedly not very natural) construct: `fooModifier-` - function( foo, value ) { foo$bar - bar } fooModifier( fooStack[[ 1 ]] ) -

Re: [R] Suggestion on how to make permanent changes to a singleobject in a list?

2008-01-03 Thread Charilaos Skiadas
On Jan 3, 2008, at 5:08 PM, Bert Gunter wrote: Gentlemen: I'm sorry, I don't see the problem. R's is Lisp (or Scheme)- inspired, so you need to think in terms of lists, or equivalently, trees. So what you seem to want to do is easily navigate down a tree to modify a node. This is

Re: [R] Suggestion on how to make permanent changes to a singleobject in a list?

2008-01-03 Thread Charilaos Skiadas
On Jan 4, 2008, at 12:06 AM, Peter Waltman wrote: fooStack[[1]] - fooModifier(fooStack[[1]]) I thought of this idea as well, and may go with it, if the Gabor's environments idea doesn't work snip Peter, perhaps it would help if you gave us more context into why you wanted this done,

Re: [R] Seeking a more efficient way to read in a file

2008-01-02 Thread Charilaos Skiadas
On Jan 2, 2008, at 6:05 PM, Talbot Katz wrote: Hi. I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two

Re: [R] tcltk again

2007-12-30 Thread Charilaos Skiadas
On Dec 30, 2007, at 11:55 AM, Richard Müller wrote: Oops, I just sent the wrong mail. It should be the following one. Please delete my mail from 30.Dez. 17:51 Sorry, but I don't really understand the recommended method using the tk-Box tkGetSaveFile. I wrote the following code:

Re: [R] refering to variable names in lm where the variable name is in another variable

2007-12-30 Thread Charilaos Skiadas
On Dec 30, 2007, at 12:49 PM, Daniel O'Shea wrote: I am trying to refer to a variable name in a lm regression where the variable name is in another variable, but it does seem to work. Here is an example: y-rnorm(10) dat-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10))

Re: [R] Help with lm and multiple linear regression? (Plain Text version)

2007-12-27 Thread Charilaos Skiadas
Hi Aaron, if I understand your question correctly, you can use the . in the formula, like so: dat - data.frame(x=1:10,y=rnorm(10),z=10:1) lm(x~., data=dat) The dot there stands for everything not already specified, so in this case that would be y and z (since x is already on the lhs). You

Re: [R] Understanding eval

2007-12-23 Thread Charilaos Skiadas
On Dec 23, 2007, at 9:21 AM, Duncan Murdoch wrote: On 23/12/2007 9:15 AM, Duncan Murdoch wrote: On 22/12/2007 5:45 PM, Charilaos Skiadas wrote: On Dec 22, 2007, at 4:44 PM, Duncan Murdoch wrote: 5) eval then creates the environment where this evaluation will take place. It does

Re: [R] expand.grid function

2007-12-23 Thread Charilaos Skiadas
Hi Derek, On Dec 23, 2007, at 10:59 PM, dxc13 wrote: useR's, I have used expand.grid() several times and like the results it gives me. I am now trying something with it that I have not been able to get to work. For any n column matrix I would like to run this function on those n

[R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
After many hours of debugging code, I came to the conclusion that I have a fundamental misunderstanding regarding eval, and hope that someone here can explain to me, why the following code acts as it does: foo - function(expr) { eval(substitute(expr), envir=list(a=5),

Re: [R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
On Dec 22, 2007, at 4:44 PM, Duncan Murdoch wrote: 5) eval then creates the environment where this evaluation will take place. It does that by creating an environment containing the frame a=5, and with enclosing environment the parent frame of foo, which is bar's environment. 6) So,

Re: [R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
eval.parent(mc) } bar2(a) On Dec 22, 2007 3:30 PM, Charilaos Skiadas [EMAIL PROTECTED] wrote: After many hours of debugging code, I came to the conclusion that I have a fundamental misunderstanding regarding eval, and hope that someone here can explain to me, why the following code acts

Re: [R] ifelse problem

2007-12-20 Thread Charilaos Skiadas
To check for NA, use is.na. For instance your second ifelse should read: ifelse(is.na(Sheet1$Claims),0,Sheet1$Claims)) Converting Sheet1$Claims to character doesn't have the effect you think it does. NA is still NA, it does not become NA. Try for instance: as.character(NA) as.character(NA)

Re: [R] seq_len

2007-12-08 Thread Charilaos Skiadas
On Dec 8, 2007, at 1:02 AM, Joe W. Byers wrote: In a post on R-devel, Prof Ripley add the following comment | BTW, 1:dim(names)[1] is dangerous: it could be 1:0. That was the | motivation for seq_len. I use the dim(names)[1] and dim(x)[2] along with length(x) with varying levels of

Re: [R] Question about using “par”

2007-11-29 Thread Charilaos Skiadas
On top of which, you should expect a setting of mfrow=c(1,2) like you have to only allow you to put two figures in 1 row and 2 columns. Haris Skiadas Department of Mathematics and Computer Science Hanover College On Nov 29, 2007, at 9:35 AM, Dieter Menne wrote: cathelf cathelf at hotmail.com

Re: [R] boxplot with datapoint

2007-11-28 Thread Charilaos Skiadas
On Nov 28, 2007, at 5:59 PM, Yupu Liang wrote: Hi, I'm using boxplot in R to show box-whiskers plots for about 15 categories of data. I'd like to display ALL of the data points--not just the outliers. Does anyone know if there's a parameter setting that will accomplish this with boxplot?

Re: [R] how to read in a txt file with some blanks

2007-11-28 Thread Charilaos Skiadas
Allen, what is the separator then? Can you give us a minimal example of a file? Otherwise we can't really help you much I'm afraid. If you want spaces to count as NA, then you want to set na.strings= probably, but read.table by default uses spaces to separate columns, so you will want to

Re: [R] [OT] putting URLs in Latex

2007-11-27 Thread Charilaos Skiadas
Nice cheatsheet! Edna, in that cheatsheet you'll find a mention to a package called url. That's what you want to use. Haris Skiadas Department of Mathematics and Computer Science Hanover College On Nov 28, 2007, at 12:31 AM, Gabor Grothendieck wrote: See:

Re: [R] [:]

2007-11-24 Thread Charilaos Skiadas
Alexy, note that negative indices have a different meaning in R, namely they indicate elements to remove. v[-(1:i)] would mean all but the elements from 1 to i (make sure i is non-negative first). So if you want: All elements up to i: v[1:i] All elements from i: v[-1:(i-1)] You

Re: [R] missing values

2007-11-23 Thread Charilaos Skiadas
Here's my take on it, don't know if you cared at all about optimizing the first couple of lines: data - data.frame(x=rep(c(A,B),5), y=c(NA,NA,rnorm(8))) means - with(data,ave(y, as.character(x), FUN=function(x) mean(x, na.rm=TRUE))) data$y - ifelse(is.na(data$y),means,data$y) I tend to not

Re: [R] Permutation of a distance matrix

2007-11-16 Thread Charilaos Skiadas
On Nov 16, 2007, at 6:42 PM, Andrew Park wrote: Hi there, I would like to find a more efficient way of permuting the rows and columns of a symmetrical matrix that represents ecological or actual distances between objects in space. The permutation is of the type used in a Mantel test.

Re: [R] save p-value in mshapiro.test(mvnormtest)

2007-11-16 Thread Charilaos Skiadas
On Nov 16, 2007, at 8:04 PM, Jiao Yang wrote: Dear all, I want to save the p-value from mshapiro.test(mvnormtest). But mshapiro.test(mvnormtest) gives a list with class htest containing statistic, p.value, method and data.name as a whole. Elements of a list are accessed, among other

Re: [R] Romoving elements from a vector. Looking for the opposite of c(), New user

2007-11-15 Thread Charilaos Skiadas
On Nov 15, 2007, at 9:15 AM, Thomas Frööjd wrote: Hi I have three vectors say x, y, z. One of them, x contains observations on a variable. To x I want to append all observations from y and remove all from z. For appending c() is easily used x - c(x,y) But how do I remove all

Re: [R] generate combination set

2007-11-15 Thread Charilaos Skiadas
I must be missing something. What's wrong with: combn(set, 2) or if we must t(combn(set,2)), optionally with a function argument in the combn call if something is to be done with the pairs? So if you really wanted the outputs to be AB,AC etc, you would do: combn(set,2, paste, collapse=)

Re: [R] Sweaving single master file to get multiple individualised reports

2007-11-08 Thread Charilaos Skiadas
On Nov 8, 2007, at 5:42 PM, Edith Hodgen wrote: Hi [snip] What I think the problem is (I'm hoping it's not) —-- I've used odfWeave to do something similar, and was then able to specify both the infile and the outfile (and so could go something like infile

Re: [R] Indexing, and using an empty string as a name

2007-11-07 Thread Charilaos Skiadas
of Mathematics and Computer Science Hanover College My off-list reply follows. On Nov 7, 2007, at 7:35 AM, Charilaos Skiadas wrote: On Nov 7, 2007, at 2:51 AM, Prof Brian Ripley wrote: On Tue, 6 Nov 2007, Charilaos Skiadas wrote: Hello all, I ran into the following, to me unexpected

[R] Indexing, and using an empty string as a name

2007-11-06 Thread Charilaos Skiadas
Hello all, I ran into the following, to me unexpected, behavior. I have (for reasons that don't necessarily pertain to the question at hand, hence I won't go into them) the need/desire to use an empty string for the name of a vector entry. Perhaps I did not read ?[ very carefully, but it

[R] Rcmdr Plugin and menus.txt

2007-11-01 Thread Charilaos Skiadas
Hi all, I'm trying to write a plugin for R Commander, following the model of the TeachingDemos plugin. I am struggling trying to even add items by editing the menus.txt file. I would welcome any help from anyone who has messed with it. Essentially the problem I am having is: I

Re: [R] Rcmdr Plugin and menus.txt

2007-11-01 Thread Charilaos Skiadas
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charilaos Skiadas Sent: Thursday, November 01, 2007 2:53 PM To: R-help help Subject: [R] Rcmdr Plugin and menus.txt Hi all, I'm trying to write a plugin for R Commander, following the model of the TeachingDemos

Re: [R] Accessing scripts in a different directory on a Mac

2007-10-26 Thread Charilaos Skiadas
You could simply create your own function, to avoid repeating the paste part each time: scriptdir - path.to.scripts my.source - function(file) { source(file.path(scriptdir,file)) } my.source(file.r) my.source(anotherfile.r) ... (You'll have to watch out for correct number of slashes

[R] Manual recycling of vectors?

2007-10-19 Thread Charilaos Skiadas
Sorry if this is already answered somewhere, but I could not find it. I have two vectors, x,y, of different length, and I want to recycle the smaller one (whichever one it is) until they have the same length. I was wondering if there is a anything better than something like: x-1:3 y-1:10

<    1   2