[R] R Group forming on LinkedIn

2008-03-27 Thread agdesilva
Greetings: I am forming an R Group on LinkedIn.Com for job seekers and potential employers. Please consider joining. http://www.linkedin.com/e/gis/77616/0AEFE3574537 Regards, Ajit __ R-help@r-project.org mailing list

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Tribo Laboy wrote: I realized that not everyone has Matlab and that basically the issue is purely how to deal with the returned data in R, so I have revised my example code and made it easier to copy-paste and run: Only for those with matlab! The rest of us have little

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Prof Brian Ripley
Oh please don't recommend misuse of @ to those already confused. @ is for accessing slots in S4 objects. This 'works' because they happen to be stored as attributes. See the help page (and the warning that it does no checking - we may change that). Similarly, plt$title - My Title works

[R] question about Randonization

2008-03-27 Thread Catalina Lopez Ospina
Dear all; I want to know if I can make a two way MANONA , Manova, and Anovas with randonization using the R program, if possible, How I can make my matrix for perform this tests. Thanks Catalina Lopez-Ospina __ R-help@r-project.org mailing list

[R] Statistical Models in S by Chambers

2008-03-27 Thread 7*Mantis
Could someone please tell me if this book is still worth buying and using or is it outdated and not very practical for use in R. Thank you. -- View this message in context: http://www.nabble.com/Statistical-Models-in-S-by-Chambers-tp16320131p16320131.html Sent from the R help mailing list

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread Sebastian Weber
Hi! In this case you are better off moving away from qplot (which does various substitute tricks to assemble the named variables in a data frame) to a more explicit form of ggplot: pl2[[obs]] - ggplot(cData, aes_string(x=x3, y=obs)) + geom_point() + opts(title = obs) Ok, I will try that,

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
So am I to understand that the only realy _correct_ and _recommended_ way of accessing the attributes is through attr(someobject, attributename) ? Regards, TL On Thu, Mar 27, 2008 at 4:16 PM, Prof Brian Ripley [EMAIL PROTECTED] wrote: Oh please don't recommend misuse of @ to those already

Re: [R] Significance of confidence intervals in the Non-Linear Least Squares Program.

2008-03-27 Thread Prof Brian Ripley
On Wed, 26 Mar 2008, glenn andrews wrote: I am using the non-linear least squares routine in R -- nls. I have a dataset where the nls routine outputs tight confidence intervals on the 2 parameters I am solving for. nls() does not ouptut confidence intervals, so what precisely did you do? I

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Tribo Laboy
Hello, Thanks for the input. I thought it wasn't much fun to talk to myself on the public forums. ;-) Trying the line you suggested generated and error: as.data.frame(drop(labpcimport)) Error in data.frame(Maker = list(HP, HP, Sony, DELL, whitebox, : arguments imply differing number of

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
Now, how is it that I can access the contents of a named list by dynamically computed name? To go back to my previous example I have a list and I know the names. Now I want do something with that named data in a loop. lst - list(x = 1:3, y = 4:6, z = 7:9) nm -names(lst) nm [1] x y z I can

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Robert A LaBudde
At 05:06 PM 3/26/2008, Ted Harding wrote: On 26-Mar-08 21:26:59, Ala' Jaouni wrote: X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks I don't think so. A whileago you wrote The

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
Thanks, this really solved my problem. Actually, I do have a good introduction to R - a book co-authored by some W.N. Venables and some B.D. Ripley, colloquially called 'MASS' is on my desk. I find it really very helpful. Still, as it is a book on statistics, some details on R are only

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Tribo Laboy
I have packaged the above posted code as a function and I am posting it here in case someonw would find it useful in the future. --function begin - readMat2df - function(readfiledata, datastr){ tmpdata - readfiledata[[datastr]] # use the string contained

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Richard . Cotton
I realized that not everyone has Matlab and that basically the issue is purely how to deal with the returned data in R, so I have revised my example code and made it easier to copy-paste and run: #Make a data frame in R Maker - factor(c(HP, HP, Sony, DELL, whitebox,

[R] Execute R with *.RData argument

2008-03-27 Thread Bio7
Dear R developers, i would like to start R with a *.RData argument under Linux. Something like R -f /home/user/workspace.RData Is this possible? Thanks in advance for any answers. -- View this message in context: http://www.nabble.com/Execute-R-with-*.RData-argument-tp16323374p16323374.html

[R] lme equivalent of formula aov

2008-03-27 Thread guillaume chaumet
Hi R people, In lme package, I'm searching to find equivalent formula of: aov(frt~consistency*length*context+Error(subject/(consistency*length*context),data=agE1B4) I try this : lme(fixed=frt~consistency*length*context, random=~1|subject, data=agE1B4) but I did not obtain same F value with

[R] Standard error values returned by lm()

2008-03-27 Thread Nick Chorley
Hi, This may be a stupid question, but how are the std. error values returned by lm() calculated? For example summary(lm) Call: lm(formula = log10(moments[2, 1:10]) ~ log10(L_vals[1:10])) Residuals: Min 1Q Median 3QMax -0.0052534 -0.0019473 0.0006785

Re: [R] inheritence in S4

2008-03-27 Thread cgenolin
Sorry to come back on callNextMethod, I am still not very confident about it. Consideres the following (there is a lot of code, but very simple with almost only some cat) : -- setClass(A,representation(a=numeric)) setValidity(A,function(object){cat( * Valid A *\n);TRUE})

[R] snow, stopping cluster

2008-03-27 Thread Markus Schmidberger
Hello, is there any function in the package snow to check for a really running cluster? The function checkCluster only checks the variable cl. And the variable is still available after stopping the cluster! ( a simple solution would be deleting the cluster variable cl in the function

Re: [R] Standard error values returned by lm()

2008-03-27 Thread Uwe Ligges
Type summary.lm and read the code. Best, Uwe Ligges Nick Chorley wrote: Hi, This may be a stupid question, but how are the std. error values returned by lm() calculated? For example summary(lm) Call: lm(formula = log10(moments[2, 1:10]) ~ log10(L_vals[1:10])) Residuals:

Re: [R] Loading library lme4

2008-03-27 Thread Uwe Ligges
Reinstall Matrix. Uwe Ligges Guy Forrester wrote: Dear all, I an running R on a Windows 2000 machine (1.5Gb RAM) and am trying to load the lme4 package, however, whenever I attempt to load the library lme4 I get the following error message I have installed lme4 and Matrix locally from

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Bio7 wrote: Dear R developers, i would like to start R with a *.RData argument under Linux. Something like R -f /home/user/workspace.RData Is this possible? $ R ... load(/home/user/workspace.RData) or put that line in your .Rprofile -- see ?Startup. (My guess is

Re: [R] Nothing happened when I using t.test throuth RSPerl

2008-03-27 Thread Prof Brian Ripley
That is a *Perl* error, and my guess is that you haven't set your environment variables correctly. R was not even started. RSPerl is an Omegahat package, and as the Omegahat mailing lists were down (last time I looked) I suggest you contact the author. The R posting guide asks that non-R

Re: [R] Loop problem

2008-03-27 Thread Jim Lemon
Jamie Ledingham wrote: Dear all, I have a problem with a loop, if anyone has any knowledge on these things I would appreciate some comments. The code below is designed to allow me to extract the top record of the data frame, and them remove rows from the data frame which have an index close

Re: [R] Re place with previous value

2008-03-27 Thread bartjoosen
Maybe something like: f - function(x,y) ifelse(sign(y[x])==-1,return(y[x-1]), return(y[x])) test[,3] - sapply(seq_along(test[,3]),f,test[,3]) Ravi S. Shankar wrote: Hi R, I have a dataframe with dim(test) [1] 435150 4 class(test) [1] data.frame In the third column every time

Re: [R] Loop problem

2008-03-27 Thread Jim Lemon
Oops, missed the first line of the example: storm.data-data.frame(meas.index=10001:2,cumrain=runif(1,-10,10)+10) You can generalize the function to whatever column names you have like this: find.max.rain-function(raindata,howmany,raincol) { # a lazy way of getting the same structure

[R] [R-pkgs] Update of TeachingDemos package

2008-03-27 Thread Greg Snow
This is to announce that versio 2.0 of the TeachingDemos package is now on CRAN (and hopefully soon to a mirror near you). This is a major upgrade of the package, some of the improvements include: The package now uses an NAMESPACE so it is easier to load just the parts that you need. Some of

Re: [R] Mac OS X 10.4.11 - R2.6.2 - Problem with proxy

2008-03-27 Thread Liviu Andronic
Hello Vincent, On Thu, Mar 27, 2008 at 11:25 AM, Vincent Alcouffe [EMAIL PROTECTED] wrote: I have 60 Macintoshs on Mac OS X 10.4.11 for learn R to studient of University and i want to Install New Packages. I click on the button access list Mirrors and it propose me a list of mirrors.

[R] Covariates in LME?

2008-03-27 Thread Aberg Carl
Hi, Im using lme to calculate a mixed factors ANOVA according to: px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) where dep is a threshold, time is a repeated measures variable (2 levels) group is a between subjects variable (2 levels) id is a random factor (subject

[R] adding bwplot to existing bwplot

2008-03-27 Thread Karin Lagesen
Hello. I have made many normal boxplots where I have added a new boxplot to an existing one. When I have done this, I have used the at command to move the boxplots a bit so that they could fit next to eachother, like this: boxplot(data.., at = number_of_categories-0.15) boxplot(data..,

[R] Covariates in LME

2008-03-27 Thread Aberg Carl
Hi, Im using lme to calculate a mixed factors ANOVA according to: px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) where dep is a threshold, time is a repeated measures variable (2 levels) group is a between subjects variable (2 levels) id is a random factor (subject

[R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both instruments are non-negative, so if

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread hadley wickham
Ok, I will try that, thanks. BTW, where is this aes_string option documented, sounds useful? How could I do the same thing with facetting? If I want to save something like . ~ groupVar as a string in a variable, could I pass it with facet_string to ggplot? It's a see also from ?aes (or at

Re: [R] Rule for accessing attributes?

2008-03-27 Thread hadley wickham
xydf - data.frame(x = 1:5, y = 11:15) plt - ggplot(data = xydf, aes(x = x,y = y)) + geom_point() attributes(plt) Now we can change the title: plt$title - My Title plt This is rather poorly documented, but the preferred way of setting the title is now: p + opts(title = My Title)

Re: [R] difference between 2 ecdfs

2008-03-27 Thread Erwann.Rogard
Thanks to David and Zaihra for their help. Besides plotting the difference between 2 ecdfs, I also would like it to *look like* a step function. Any suggestion? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Winsemius Sent: Friday, March 21, 2008

Re: [R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Tom Cohen wrote: Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both

Re: [R] difference between 2 ecdfs

2008-03-27 Thread Zaihra T
Please chk out the url below it might be of some help for plotting step function or *look like* of step function. On Thu, 27 Mar 2008 09:03:58 -0400 wrote: Thanks to David and Zaihra for their help. Besides plotting the difference between 2 ecdfs, I also would like it to

Re: [R] avoiding loops

2008-03-27 Thread Ingmar Visser
Thanks for this. I was afraid someone was going to say this ... Does this mean the only way of getting this to run faster is by moving to C code? The cases I'm thinking of applying this in have dimensions of A that are much larger than the example, eg n by n by T where n has a max of 10 or so

Re: [R] Slow code display in R console

2008-03-27 Thread John Kane
It could be almost anything. You need to supply some information about what you are doing and your system It would be a good idea to supply the information that sessionInfo() gives. --- Huilin Chen [EMAIL PROTECTED] wrote: Hi When I copy a block of code to R console, the code would be

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Christos Hatzis
Yes, indeed. The help page says that @ extracts the contents of a slot in S4 objects. But you mention below that this 'works' for S3 objects because S4 slots are stored as attributes. Doesn't this mean that @ is currently implemented to access attributes of objects in general (attributes of S3

[R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Dear all, I have a piece of code along the lines of f - function(x) { clipname - LK # but is in real determined based on info in data.frame x # other manipulations return( list(clipname=list())) } My intention is to do out - f(dat) and then (in this example) having/getting out$LK

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Naji Nassar
Hi all One suggestion, tranforme the x 0x11 Tranforme x1=exp(u1)/(exp(u1)+exp(u2)+exp(u3)+1) 0x21 Tranforme x2=exp(u2)/(exp(u1)+exp(u2)+exp(u3)+1) 0x31 Tranforme x3=exp(u3)/(exp(u1)+exp(u2)+exp(u3)+1) 0x41 Tranforme x4= 1/(exp(u1)+exp(u2)+exp(u3)+1) x1+x2+x3+x4=1 Now

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
Try this: foo - function(x) { clipname - LK out - list() out[[clipname]] - rnorm(5) return(out) } On 27/03/2008, Paul Lemmens [EMAIL PROTECTED] wrote: Dear all, I have a piece of code along the lines of f - function(x) { clipname - LK # but is in real determined based on info in

Re: [R] options in 'rnorm' to set the lower bound of normal dist

2008-03-27 Thread Ted Harding
Brian Ripley's suggestions of truncated normal and log-normal are of course resources for ensuring that you get positive simulated results. However, I think youre real problem (having looked at the numbers you quote) is that you should not be thinking of using a normal distribution, or anything

[R] strptime and plot(),lines()

2008-03-27 Thread erkan yanar
Hello, Im reading Data out of a Database. #v+ rs - dbGetQuery(con,SELECT * ... ) attach(rs) #v- There ist a colum I convert into Time. #v+ zeit-strptime(datum,format=%Y-%m-%d %H:%M:%S); class(zeit) [1] POSIXt POSIXlt #v- 1. A plot(zeit,money) plots the Data. All i see on the x-achis are

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Deepayan Sarkar
On 3/26/08, Agustin Lobo [EMAIL PROTECTED] wrote: Dear list, Is there any way of making barplots as a Trellis graphic? Yes, the function to use is 'barchart'. -Deepayan __ R-help@r-project.org mailing list

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Hi Henrique, On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: Try this: foo - function(x) { clipname - LK out - list() out[[clipname]] - rnorm(5) return(out) } That easy ... Hadn't thought of it. But now I have a refinement in foo() foo - function(x)

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Christos Hatzis wrote: Yes, indeed. The help page says that @ extracts the contents of a slot in S4 objects. But you mention below that this 'works' for S3 objects because S4 slots are stored as attributes. Doesn't this mean that @ is currently implemented to access

[R] how to apply bootstrap with a grouping variable?

2008-03-27 Thread Alfonso Pérez
Hello, my name is Alfonso. I'm trying to apply bootstrap to a database. This database present as variables: cohort, age, length, an group. The variable group is unique for each age*cohort, at this way, if we have 18 cohorts and we study individuals with an age between 2 and 10 years (9

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
HI, I don't understand why you're using lapply. Please provide a example of your 'x' data.frame str(x) On 27/03/2008, Paul Lemmens [EMAIL PROTECTED] wrote: Hi Henrique, On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: Try this: foo - function(x)

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Gabor Grothendieck
Not sure if this is sufficient but if you always open your RData file in the same directory this may be good enough: mkdir ~/tmp cd ~/tmp R x - 33 q() # answer y to save in .RData Now whenever you open R in ~/tmp it will load .RData containing x. You must be in ~/tmp and the file must be called

Re: [R] strptime and plot(),lines()

2008-03-27 Thread Gabor Grothendieck
You normally want to represent your times as POSIXct rather than POSIXlt so try xct - as.POSIXct(xlt) or you may want to use chron. Read read more about this in R News 4/1 which has info on dates and times. Use the axis or Axis command to create custom axes. ?axis ?Axis You may also want to

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Hi, Sorry yes, I forgot to give comment about the lapply(). foo - function(x) { out - list() lapply(x$clipno, function(c) { clipname - x$clipname # stuff out[[clipname]] - rnorm(5) }) return(out) } So x is a dataframe with the data from one subject

Re: [R] Want to draw 3D cylinder objects

2008-03-27 Thread Greg Snow
Here is one approach to drawing simple cylinders at specified locations, the height, width, and angle should all be numbers between 0 and 1 and you may want to rewrite the ms.cylinder function below so that the arguments are more meaningful relative to the input data that you want to use:

Re: [R] options in 'rnorm' to set the lower bound of normal dist

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, [EMAIL PROTECTED] wrote: Brian Ripley's suggestions of truncated normal and log-normal are of course resources for ensuring that you get positive simulated results. I was answering the question asked! Wanting to simulate from the fitted mean and sd does *not* mean you

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Charles C. Berry
On Thu, 27 Mar 2008, Robert A LaBudde wrote: At 05:06 PM 3/26/2008, Ted Harding wrote: On 26-Mar-08 21:26:59, Ala' Jaouni wrote: X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks I

Re: [R] strptime and plot(),lines()

2008-03-27 Thread Don MacQueen
As Gabor said, your zeit should be a POSIXct object, not a POSIXlt object. Then, for example: zeit - Sys.time() + 150*runif(10) val - rnorm(10) plot(zeit,val,xaxt='n') axis.POSIXct(1,zeit, format='%Y-%m-%d %H:%M') Or better (perhaps) yet: plot(zeit,val,xaxt='n')

[R] help! - spectral analysis - spec.pgram

2008-03-27 Thread Nuno Prista
Can someone explain me this spec.pgram effect? Code: period.6-c(0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10 ,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10) period.5-c(0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10

Re: [R] snow, stopping cluster

2008-03-27 Thread Luke Tierney
Not at present. The next release should include something along these lines. luke On Thu, 27 Mar 2008, Markus Schmidberger wrote: Hello, is there any function in the package snow to check for a really running cluster? The function checkCluster only checks the variable cl. And the

[R] Reading in multiple files in a loop

2008-03-27 Thread Zu Thur Yew
Hi, I'm new to R and want to use it to analyse a number of data files (e.g. 100). I want to read in multiple files in a loop in a specific order (e.g. 1 to 100) and was hoping to do something like: for (r in 1:100) { d1 -read.table(r.anl) for (r2 in 1:100) { d2 -read.table(r2.anl) cc

Re: [R] help! - spectral analysis - spec.pgram

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Nuno Prista wrote: Can someone explain me this spec.pgram effect? Code: period.6-c(0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10 ,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10)

[R] A faster way to compute finite-difference gradient of a scalar function of a large number of variables

2008-03-27 Thread Ravi Varadhan
Hi All, I would like to compute the simple finite-difference approximation to the gradient of a scalar function of a large number of variables (on the order of 1000). Although a one-time computation using the following function grad() is fast and simple enough, the overhead for repeated

Re: [R] Reading in multiple files in a loop

2008-03-27 Thread Paul Lemmens
On Thu, Mar 27, 2008 at 4:40 PM, Zu Thur Yew [EMAIL PROTECTED] wrote: for (r in 1:100) { d1 -read.table(r.anl) read.table(paste(r,.anl, sep=)) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
Thanks Prof Brian for your suggestion. I should know that for right-skewed data, one should generate the samples from a lognormal. My problem is that x and y are two instruments that were thought to be measured the same thing but somehow show a wide confidence interval of the difference

Re: [R] inheritence in S4

2008-03-27 Thread Martin Morgan
[EMAIL PROTECTED] wrote: Sorry to come back on callNextMethod, I am still not very confident about it. Consideres the following (there is a lot of code, but very simple with almost only some cat) : -- setClass(A,representation(a=numeric))

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
But, your lapply is: lapply(x$clipno, function(c){ clipname - x$clipname out[[clipname]] - rnorm(5) }) So, you don't use 'c' argument. On 27/03/2008, Paul Lemmens [EMAIL PROTECTED] wrote: Hi, Sorry yes, I forgot to give comment about the

Re: [R] A faster way to compute finite-difference gradient of a scalarfunction of a large number of variables

2008-03-27 Thread Christos Hatzis
Here is as solution that calculates derivatives using central differences by appropriately embedding the vectors: grad.1 function(x, fn) { x - sort(x) x.e - head(embed(x, 2), -1) y.e - embed(fn(x), 3) hh - abs(diff(x.e[1, ])) y.e - apply(y.e, 1, function(z) (z[1] - z[3])/(2 * hh))

[R] R Code and the Pygments Python SyntaxHighlighter

2008-03-27 Thread Hans W. Borchers
Dear R Help, is someone going to write a R/S language lexer for the Pygments Python syntax highlighter http://pygments.org/? As it is used now by Trac, Django, or the Python documentation tool Sphinx, the R community can apply it in Python-based Wikis like Moinmoin and others. Hans Werner

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Dimitris Rizopoulos
If 'myfunc' is a vector function and can be vectorized in R, then it is even faster to use the following: grad.vec - function(x, fn, ..., eps = sqrt(.Machine$double.neg.eps)){ x1 - x + eps * pmax(abs(x), 1) x2 - x - eps * pmax(abs(x), 1) (fn(x1, ...) - fn(x2, ...)) / (x1 - x2) }

[R] Dendrogram orientation

2008-03-27 Thread Lassana TOURE
I am using the two functions hclust and plot to draw a dendrogram. The result is a vertical dendrogram , but I prefer a horizontal one. Need help. This is my script: dd1=hclust(d1, method=ward) plot(dd1) [[alternative HTML version deleted]]

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Ravi Varadhan
Thank you, Dimitris Christos. Yes, myfunc is a scalar function that needs to be minimized over a high-dimensional parameter space. I was afraid that there might be no better way, apart from coding in C. Thanks, Dimitris, for confirming my fear! Best regards, Ravi.

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Ravi Varadhan wrote: Thank you, Dimitris Christos. Yes, myfunc is a scalar function that needs to be minimized over a high-dimensional parameter space. I was afraid that there might be no better way, apart from coding in C. Thanks, Dimitris, for confirming my fear!

Re: [R] Thinking about using two y-scales on your plot?

2008-03-27 Thread Martin Rittner
Hello all, I know I'm not making friends with this, but: I absolutely see the point in dual-(or more!)-y-axis plots! I find them quite informative, and I see them often. In Earth-Sciences (and I very generously include atmospheric sciences here, as Johannes has given an example of a

[R] Recode factors

2008-03-27 Thread Doran, Harold
I know this comes up, but I didn't see my exact issue in the archives. I have variables in a dataframe that need to be recoded. Here is what I'm dealing with I have a factor called aa class(aa) [1] factor table(aa) aa *0123ABCDLNT 00

Re: [R] Recode factors

2008-03-27 Thread Henrique Dallazuanna
If I understand, you can try this: levels(x)[is.na(as.numeric(levels(x)))] - 0 On 27/03/2008, Doran, Harold [EMAIL PROTECTED] wrote: I know this comes up, but I didn't see my exact issue in the archives. I have variables in a dataframe that need to be recoded. Here is what I'm dealing with

Re: [R] Recode factors

2008-03-27 Thread Doran, Harold
Perfect. My headache is gone. Thanks. -Original Message- From: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2008 12:50 PM To: Doran, Harold Cc: r-help@r-project.org Subject: Re: [R] Recode factors If I understand, you can try this:

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Agustin Lobo
Thanks, it was a matter of reshaping the data matrix as I usually have it, ie: datos - data.frame(x=abs(round(rnorm(100,10,5))),y=abs(round(rnorm(100,2,1))),f=factor(round(runif(100,1,3 to become: datos2 -

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Charilaos Skiadas
On Mar 27, 2008, at 1:47 PM, Agustin Lobo wrote: Thanks, it was a matter of reshaping the data matrix as I usually have it, ie: datos - data.frame(x=abs(round(rnorm(100,10,5))),y=abs(round(rnorm (100,2,1))),f=factor(round(runif(100,1,3 to become: datos2 -

[R] assistance with RDAtest beta version application

2008-03-27 Thread Stanfield, Les (MNR)
Pierre Legendre has developed a beta version of a new redundancy analysis package called RdaTest that is available on his web page at the Universit® de Montréal. The test example that is included with the package is based on the example provided in his book (Numerical Ecology, Chapter 11

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Bio7
Thanks for the nice tip. I also consider to use the clipboard to transfer a command with the file path which then can be pasted easily in the shell and executed. Gabor Grothendieck wrote: Not sure if this is sufficient but if you always open your RData file in the same directory this

Re: [R] Recode factors

2008-03-27 Thread Abhijit Dasgupta
Another suggestion is: blah = as.character(aa) blah=gsub('[a-z]','0',blah,ignore.case=T) aa = as.factor(blah) I've found changing factors to characters rather than numeric is generally safer. Abhijit Doran, Harold wrote: Perfect. My headache is gone. Thanks. -Original Message-

[R] histogram for integer data

2008-03-27 Thread Erwann.Rogard
hi, library(lattice) x-c(-1,-1,-1,0,0,0,0,1,1,2) rng-range(x) histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nint=length(unique(x))) instead of contiguous bins, i'd like spaces between them to indicate that the data is discrete, or even better, line segments positioned at integer values. i

Re: [R] assistance with RDAtest beta version application

2008-03-27 Thread Guillaume Blanchet
Hi ! I am familiar with the rdaTest package. It works perfectly find for me. Can you give me more details on the problems you have so I can be of greater help ! Have a nice day ! Guillaume Blanchet PhD student Stanfield, Les (MNR) a écrit : Pierre Legendre has developed a beta version of a

[R] dreaded p-val for d^2 of a glm / gam

2008-03-27 Thread Monica Pisica
OK, I really dread to ask that much more that I know some discussion about p-values and if they are relevant for regressions were already on the list. I know to get p-val of regression coefficients - this is not a problem. But unfortunately one editor of a journal where i would like to

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Michael A. Miller
James == James Root [EMAIL PROTECTED] writes: Is there a way to run all paired t-tests where a paired t-test is run for every possible combination? Sounds like pairwise.t.test is the sort of thing you are looking for... Mike __

[R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Diogo André Alagador
Hi all, I would like to know if it is posible by, someway, to get colMeans from a data.frame with numeric as well as character data, dispersed all over the object. Note that I would like to get colMeans neglecting character data. I am really in need of some function proceeding in that way…

Re: [R] histogram for integer data

2008-03-27 Thread Don MacQueen
You might consider something based on the concept of: y - table( x) plot( as.numeric(names(y)) , y, type='h') -Don At 2:59 PM -0400 3/27/08, [EMAIL PROTECTED] wrote: hi, library(lattice) x-c(-1,-1,-1,0,0,0,0,1,1,2) rng-range(x)

Re: [R] histogram for integer data

2008-03-27 Thread Erwann.Rogard
Thanks! Yes, but I also want to be able to condition easily hence histogram(...), not plot -Original Message- From: Don MacQueen [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2008 3:55 PM To: Rogard, Erwann RD/US/EXT; r-help@r-project.org Subject: Re: [R] histogram for integer

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Rolf Turner
On 28/03/2008, at 8:42 AM, Michael A. Miller wrote: James == James Root [EMAIL PROTECTED] writes: Is there a way to run all paired t-tests where a paired t-test is run for every possible combination? Sounds like pairwise.t.test is the sort of thing you are looking for... Mike

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Dimitris Rizopoulos
try this: dat - data.frame(x = rnorm(10), y = rexp(10), z = letters[1:10]) colMeans(data.matrix(dat[sapply(dat, is.numeric)])) I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35,

Re: [R] assistance with RDAtest beta version application

2008-03-27 Thread Guillaume Blanchet
Hi !! Stanfield, Les (MNR) a écrit : Thank you so much for coming to my rescue!: OK I have been able to open it (but only in the R editor. I assumed that we had to generate our own files of XX.txt and YY.txt and bring them into R before the program could run Is this right?

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Douglas Bates
On Thu, Mar 27, 2008 at 3:05 PM, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: try this: dat - data.frame(x = rnorm(10), y = rexp(10), z = letters[1:10]) colMeans(data.matrix(dat[sapply(dat, is.numeric)])) Alternatively sapply(dat, mean) x y z -0.5260131

[R] Extracting single output data into a vector or matrix

2008-03-27 Thread Ayman Oweida
I've been struggling to do the following: After a lengthy computation, I receive an output along the lines of the list below. This list has 41 values and is not the end of my computations. I have another computation to do on the list below, but in this final computation the list is

[R] functions

2008-03-27 Thread Jan de Leeuw
I wrote some functions for multiway CANDECOMP, i.e. for least squares fitting of a_{i_1\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^1_{i_1s}\cdots x^m_{i_ms} with arrays of arbitrary dimension. Reminded me of the good old APL days. I could not find this in the archives, but if it's already

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Gabor Grothendieck
summaryBy in the doBy package can do that. The builtin iris data set has 4 numeric columns and one factor column: library(doBy) summaryBy(.~1, iris, fun = mean, keep = TRUE) Sepal.Length Sepal.Width Petal.Length Petal.Width 1 5.843.0573333.7581.199333 On Thu, Mar

Re: [R] functions

2008-03-27 Thread Jan de Leeuw
Sorry. I mean a_{i_1i_2\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^2_{i_2s}\cdots x^m_{i_ms} -- J. On Mar 27, 2008, at 12:57 , Jan de Leeuw wrote: I wrote some functions for multiway CANDECOMP, i.e. for least squares fitting of a_{i_1\cdots i_m}\approx\sum_{s=1}^p

Re: [R] Covariates in LME?

2008-03-27 Thread Douglas Bates
On Thu, Mar 27, 2008 at 7:01 AM, Aberg Carl [EMAIL PROTECTED] wrote: Hi, Im using lme to calculate a mixed factors ANOVA according to: px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) where dep is a threshold, time is a repeated measures variable (2 levels)

Re: [R] Extracting single output data into a vector or matrix

2008-03-27 Thread Mike Prager
Ayman, It is difficult to say without seeing some code, but your output seems to be not a list in the R sense but a collection of vectors, each of length 1. The best way to put the values into a vector probably is to assign them to the elements of the vector during your computations. Mike Prager

[R] list as object in dataframe

2008-03-27 Thread Daniel E. Bunker
Hi All, I need to place lists or vectors within dataframes as single elements. However when I try this: df=data.frame(y=1, x=I(list(c(a,b), c(f,c), c(a df df[1,'x']=I(c(a,d)) I get this error, even though I am using I(): Error in `[-.data.frame`(`*tmp*`, 1, x, value = c(a, d)) :

[R] panel function question

2008-03-27 Thread Weidong Gu
I have two data sets with locations, X, Y of houses (df.house) and habitats(df.habitat), respectively. In each dataset, there are 3 replicates (Repeat). Because each replicate has different locations of houses and habitats, I would like to plot them in panels. I wrote something like this:

  1   2   >