[R] Time conversion problems

2007-08-22 Thread mgilgen
Hi there I have precipitation data from 2004 to 2006 in varying resolutions (10 to 20min intervals) with time in seconds from beginnig of the year (summation) and a second variable as year. I applied follwing code to convert the time into a date: times-strptime(2004-01-01, %Y-%m-%d, tz=GMT) +

Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Paul Murrell
Hi Arjun Ravi Narayan wrote: Hi, I am editing a document for submission to the R-news newsletter, and in my article my Sweave code inserts a dynamically generated PDF report that my R program generates. However, when I insert the PDF using the following Sweave code: \newpage

Re: [R] quantile() returns a value outside the data range

2007-08-22 Thread Henrik Bengtsson
Hi, yes, it is all about numerical accuracy; x - c(6.402611, 6.402611, 6.420587) x001 - sapply(1:9, function(type) quantile(x, probs=0.01, type=type)) names(x001) - NULL print(x001) ## [1] 6.402611 6.402611 6.402611 6.402611 6.402611 ## [6] 6.402611 6.402611 6.402611 6.402611 diff(x001) ## [1]

[R] Recurrence plots for CGH

2007-08-22 Thread Richard Yanicky
I Have been trying to create a recurrence plot for multiple copy number alterations. Many of the articles I read have the plots but don't reference how they are created. Almost all the articles use R to analyze the data so I assume they use R to create the plots? I do find the plots mentioned

[R] subscript out of bounds Error in predict.naivebayes

2007-08-22 Thread Polly He
I'm trying to fit a naive Bayes model and predict on a new data set using the functions naivebayes and predict (package = e1071). R version 2.5.1 on a Linux machine My data set looks like this. class is the response and k1 - k3 are the independent variables. All of them are factors. The response

[R] [R-pkgs] brew 1.0-1

2007-08-22 Thread Jeffrey Horner
brew implements a templating framework for mixing text and R code for report generation. brew template syntax is similar to PHP, Ruby's erb module, Java Server Pages, and Python's psp module. brew is written in R with no package dependencies, and it's not just for the web. It can be used as an

Re: [R] Time conversion problems

2007-08-22 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: Hi there I have precipitation data from 2004 to 2006 in varying resolutions (10 to 20min intervals) with time in seconds from beginnig of the year (summation) and a second variable as year. I applied follwing code to convert the time into a date:

[R] displaying the means on a scatter diagram

2007-08-22 Thread squall44
Hello, I created a simple scatter diagram: x= c(53, 52, 55, 65, 71, 69, 75, 78, 88, 70) y= c(162, 165, 165, 171, 173, 175, 179, 181, 184, 176) plot(x, y) Now I would like to display the mean on that diagram. Can anyone tell me what possibilities I have to do that? Thanks in advance Tobias

Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Gregor Gorjanc
Arjun Ravi Narayan contact at arjunnarayan.com writes: I am editing a document for submission to the R-news newsletter, and in my article my Sweave code inserts a dynamically generated PDF report that my R program generates. Slightly off Arjuns topic is a problem with Schunk, Sinput and

[R] Odp: displaying the means on a scatter diagram

2007-08-22 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 22.08.2007 09:10:26: Hello, I created a simple scatter diagram: x= c(53, 52, 55, 65, 71, 69, 75, 78, 88, 70) y= c(162, 165, 165, 171, 173, 175, 179, 181, 184, 176) plot(x, y) Now I would like to display the mean on that diagram. do you think

Re: [R] rectify a program of seasonal dummies matrix

2007-08-22 Thread Uwe Ligges
Friedrich Schuster wrote: Hello, the main problem seems to be the if else, should be else if. Your code is hard to read, maybe you should consider using more () {}: T - 100; br - matrix(0,T,4); Thanks for the contribution. Please note: a) It is a bad idea to have a variable

Re: [R] Random Sampling from a Matrix

2007-08-22 Thread Uwe Ligges
Anup Nandialath wrote: Dear Friends, I have a matrix of size 5000 X 20. The first two columns are indicator variables taking the value of either 0 or 1. Let us call the first two columns Y1 and Y2. I need to randomly sample 1000 rows with all the associated columns, in other words

[R] How do i print a main title on a win.graph with several plots?

2007-08-22 Thread Tom Willems
Good Mornig All, How R you today? ;o) I have lots of questions, but i l start with the simplest one, to wich i am shy to say, i did not find the answer. It is the following: When i make a summary plot like for example plot( summary(glm)), i get one window, one main title, and 4 graph's in

Re: [R] library(fCalendar) timeDate(12.03.2005, format=%d.%m.%Y)

2007-08-22 Thread Martin Becker
Martin Maechler wrote: OL == Ola Lindqvist [EMAIL PROTECTED] on Tue, 21 Aug 2007 14:32:19 +0200 writes: OL Thanks! OL Seems to work fine now! Well, for your example. But sorry to say, the patch breaks other cases. I'm investigating further (and will hopefully

[R] plot in for loop with i indexed variables does not work

2007-08-22 Thread mgilgen
Hi there Does anyone know, why this is not working?: par(mfrow = c(5, 5)) for (i in 1:10){ plot(x=time, y=Var.i) } (x-variable is time y-variable is Var out of matrix with columns Var.1 Var.2 Var.3 etc...) even for (i in 1:10){ plot(x=time, y=paste(Var, i, sep=.)

Re: [R] plot in for loop with i indexed variables does not work

2007-08-22 Thread Dimitris Rizopoulos
you need something like this: par(mfrow = c(5, 5)) for (i in 1:10) { nam - paste(Var., i, sep = ) plot(x = time, y = mat[, nam], xlab = Time, ylab = nam) } where `mat' is the matrix containing Var.1, Var.2, Var.3, etc. I hope it helps. Best, Dimitris Dimitris Rizopoulos

Re: [R] divided scatter plots

2007-08-22 Thread Jim Lemon
Caroline Nganga wrote: I have a data set which contains two columns. The first column is a list of countries, and the second column contains their political risk ratings. I would like to create one large plot that contains 5 different sections, each with a scatter plot. To clarify, I have

Re: [R] Recurrence plots for CGH

2007-08-22 Thread Ido M. Tamir
CGH Hi, I guess you should start looking at the bioconductor project. http://www.bioconductor.org/packages/release/Software.html best wishes, ido __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] Processing Sweave documents without Sweave

2007-08-22 Thread Werner Wernersen
Hi, I am very intrigued by the idea of integrating statistical analysis directly with a paper as Sweave does it. But as I am collaborating with several people and they won't have set up R and also they're very unlikely interested in learning it, I am concerned about how such an Latex/Sweave

Re: [R] How do i print a main title on a win.graph with several plots?

2007-08-22 Thread Prof Brian Ripley
?title, look at the 'outer' argument. You can see further discussion of the outer margins in 'An Introduction to R'. I don't know why you are using win.graph(): it is a deprecated form of windows() with many of the arguments taking unchangable defaults. On Wed, 22 Aug 2007, Tom Willems wrote:

Re: [R] Processing Sweave documents without Sweave

2007-08-22 Thread Renaud Lancelot
Sweave produces a TeX file which can be exchanged like any other such file, providing that you give the possible graphic files (and bib, etc.) called from the TeX code. Best, Renaud 2007/8/22, Werner Wernersen [EMAIL PROTECTED]: Hi, I am very intrigued by the idea of integrating statistical

Re: [R] Processing Sweave documents without Sweave

2007-08-22 Thread Werner Wernersen
That sound's perfect, that's all I needed to know. Thanks for your kind help, Werner --- Renaud Lancelot [EMAIL PROTECTED] schrieb: Sweave produces a TeX file which can be exchanged like any other such file, providing that you give the possible graphic files (and bib, etc.) called from

Re: [R] within-subject factors in lme

2007-08-22 Thread lorenz.gygax
I don't think, this has been answered: I'm trying to run a 3-way within-subject anova in lme with 3 fixed factors (Trust, Sex, and Freq), but get stuck with handling the random effects. As I want to include all the possible random effects in the model, it would be something more or less

[R] ordering of variables in plots

2007-08-22 Thread elin sagulin
I'm making plots where the x-axis variables are called l hl s (for long half-long and short). I'd like them to appear in that order, but they turn up in alphabetical order: hl l s. Except for fiddling with the names of the variables, how can I fix this? That is, how can I specify what order I

[R] Ans on: How do i print a main title on a win.graph with several plots?

2007-08-22 Thread Tom Willems
Thanks Mr.Pr. Ripley, For pointing me in the good direction, i use win.graph() so i get an overview of the different graphs. Until now, i v had no problems with it, hope it stays that way. for those whom have the same porblem, this is what i do: win.graph(); op - par(mfrow = c(1,2) , oma=

Re: [R] Optimization problem

2007-08-22 Thread Gabor Grothendieck
Try this. 1. following Ben remove the Randalstown point and reset the levels of the Location factor. 2. then replace solve with ginv so it uses the generalized inverse to calculate the hessian: alan2 - subset(alan, subset = Location != Randalstown) alan2$Location -

[R] IRT model nonparametric from Ramsay in R

2007-08-22 Thread Xavier Giovanni Ordóñez Camacho
Hi: I need to apply the IRT model from Ramsay (1991), He apply the Smoothing Kernel to multiple choice test. Is possible in R?. Thank you, Xavier G. Ordonez Doctoral Student Universidad Complutense de Madrid __ R-help@stat.math.ethz.ch mailing list

Re: [R] C code generators

2007-08-22 Thread Duncan Murdoch
On 8/21/2007 10:20 PM, [EMAIL PROTECTED] wrote: Dear R-helpers Are there any established R packages that include a C code generator -- that generates new C language files and compiles them? Oleg Sklyar's inline package does that. It takes input in the form of a fragment of C (or C++,

Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Duncan Murdoch
On 8/22/2007 3:20 AM, Gregor Gorjanc wrote: Arjun Ravi Narayan contact at arjunnarayan.com writes: I am editing a document for submission to the R-news newsletter, and in my article my Sweave code inserts a dynamically generated PDF report that my R program generates. Slightly off Arjuns

Re: [R] Processing Sweave documents without Sweave

2007-08-22 Thread Duncan Murdoch
On 8/22/2007 6:40 AM, Renaud Lancelot wrote: Sweave produces a TeX file which can be exchanged like any other such file, providing that you give the possible graphic files (and bib, etc.) called from the TeX code. Yes, and since Sweave doesn't touch the formatting of the TeX code, it's not

[R] Synchronzing workspaces

2007-08-22 Thread Eric Turkheimer
How do people go about synchronizing multiple workspaces on different workstations? I tend to wind up with projects spread around the various machines I work on. I find that placing the directories on a server and reading them remotely tends to slow things down. thanks, Eric -- Eric

Re: [R] Synchronzing workspaces

2007-08-22 Thread James W. MacDonald
You could use a versioning system like Subversion or Git on the server but work with the local repository. I believe Git is the easier of the two to set up. Best, Jim Eric Turkheimer wrote: How do people go about synchronizing multiple workspaces on different workstations? I tend to wind

Re: [R] Synchronzing workspaces

2007-08-22 Thread Duncan Murdoch
On 8/22/2007 9:20 AM, Eric Turkheimer wrote: How do people go about synchronizing multiple workspaces on different workstations? I tend to wind up with projects spread around the various machines I work on. I find that placing the directories on a server and reading them remotely tends to

Re: [R] Synchronzing workspaces

2007-08-22 Thread Barry Rowlingson
Eric Turkheimer wrote: How do people go about synchronizing multiple workspaces on different workstations? I tend to wind up with projects spread around the various machines I work on. I find that placing the directories on a server and reading them remotely tends to slow things down. If

Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Gregor Gorjanc
Hi Duncan, Duncan Murdoch wrote: Slightly off Arjuns topic is a problem with Schunk, Sinput and Soutput environments. They just use to much inline space. I have tweade this problem with sed (see bellow for Makefile content), but wonder if there is a better solution. You can change the

[R] Evaluating f(x(2,3)) on a function f- function(a,b){a+b}

2007-08-22 Thread Søren Højsgaard
Dear list I have a function and a vector, say f - function(a,b){a+b} x - c(2,3) I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would like it to be so that I can write f(x). (I know I can write a wrapper function g - function(x){f(x[1],x[2])}, but this is not really

Re: [R] Evaluating f(x(2,3)) on a function f- function(a,b){a+b}

2007-08-22 Thread Gabor Grothendieck
Try this: do.call(f, as.list(x)) On 8/22/07, Søren Højsgaard [EMAIL PROTECTED] wrote: Dear list I have a function and a vector, say f - function(a,b){a+b} x - c(2,3) I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would like it to be so that I can write f(x). (I

Re: [R] Evaluating f(x(2,3)) on a function f- function(a,b){a+b}

2007-08-22 Thread Paul Smith
On 8/22/07, Søren Højsgaard [EMAIL PROTECTED] wrote: I have a function and a vector, say f - function(a,b){a+b} x - c(2,3) I want to evaluate f on x in the sense of computing f(x[1],x[2]). I would like it to be so that I can write f(x). (I know I can write a wrapper function g -

Re: [R] within-subject factors in lme

2007-08-22 Thread Gang Chen
Hi Lorenz, I really appreciate your comments. If I understand correctly, you want to include the interactions between the random and fixed terms? Yes that is exactly I wanted to model. This is done like: model.lme - lme(Beta ~ Trust*Sex*Freq, random =

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

2007-08-22 Thread Juan Manuel Barreneche
To Mark Leeds and the others, thank you for solving my problem, and so quickly, JM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

[R] Help with vector gymnastics

2007-08-22 Thread Gladwin, Philip
Hello, What is the best way of solving this problem? answer - ifelse(tf=TRUE, i * 5, previous answer) where as an initial condition tf[1] - TRUE For example if, tf - c(T,F,F,F,T,T,F) over i = 1 to 7 then the output of the function will be answer = 5 5 5 5 25 30 30 Thank you. Phil,

Re: [R] within-subject factors in lme

2007-08-22 Thread lorenz.gygax
If I understand correctly, you want to include the interactions between the random and fixed terms? Yes that is exactly I wanted to model. This is done like: model.lme - lme(Beta ~ Trust*Sex*Freq, random = ~Trust*Sex*Freq|Subj, Model) But this needs a lot of

Re: [R] Help with vector gymnastics

2007-08-22 Thread Felix Andrews
library(zoo) tf - c(T,F,F,F,T,T,F) i - seq(7) answer - ifelse(tf, i*5, NA) answer - na.locf(answer) On 8/23/07, Gladwin, Philip [EMAIL PROTECTED] wrote: Hello, What is the best way of solving this problem? answer - ifelse(tf=TRUE, i * 5, previous answer) where as an initial condition

Re: [R] Help with vector gymnastics

2007-08-22 Thread Erik Iverson
Philip - I don't know if this is the best way, but it gives you the output you want. Using your tf, vals - rle(ifelse(tf, 5*which(tf), 0)) vals$values[vals$values == 0] - vals$values[which(vals$values==0) - 1] inverse.rle(vals) [1] 5 5 5 5 25 30 30 Gladwin, Philip wrote: Hello, What

[R] 2nd label category on x axis

2007-08-22 Thread mgilgen
i'm plotting time-series and label the x-axis as follows: r - as.POSIXct(round(range(p1$time), month)) plot(p1$time,p1$ p1, type=l, xaxt=n) axis.POSIXct(1, at=seq(r[1], r[2], by=month), format=%Y.%m) what I want do do now, is a second label for the x-axis, that stands lower and indicates the

[R] Rdonlp2 control parameter question

2007-08-22 Thread Talbot Katz
Hi. I have been trying to work with the Rdonlp2 package. There is a control parameter called epsx that has the following description: epsx(1e-5) - successful temination is indicated if the Kuhn-Tucker criteria are satisfied within the value I have tried to use the donlp2.control() function

[R] distance by vegan

2007-08-22 Thread [EMAIL PROTECTED]
How to calculate sorensen (bray-curtis) distance by dist function within the vegan package? Cheers Duccio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] plotting lda results

2007-08-22 Thread Silvia Lomascolo
Hi all, I am trying to plot the results of a discriminant analysis done with lda(MASS) but my groups appear in two different plots (in the same graphics device) and I want to combine them in one plot. My code looks like: BirdTrain.lda - lda(Bdisperser~., data=BirdTrain.mx) predict(BirdTrain.lda)

[R] All subsets regression

2007-08-22 Thread Alan Harrison
Hey folks, I'm trying to do all subsets on a zero-inflated poisson regression. I'm aware of the leaps and regsubsets functions but I don't know if they work for ZIP regressions or how the syntax fits in for them. Can anyone help? The model syntax is: zip.zc -

Re: [R] plotting lda results

2007-08-22 Thread Prof Brian Ripley
Read ?plot.lda, which tells you the ... arguments are (for dimen=1, the only option for two groups) passed to ldahist, so then read its help page. I don't know what you want (and your example is not reproducible): I would expect you to get a single plot with two panels (figures), but there are

Re: [R] Output from while and for loop

2007-08-22 Thread Charles C. Berry
On Tue, 21 Aug 2007, Ryan Briscoe Runquist wrote: Hello, I am new and am having a hard time getting the proper syntax for output from loops. I am working on a simulation to generate a null expectation of bee behavior. Pieces of it work. The part that I am having specific difficulty is

Re: [R] tackle memory insufficiency for large dataset using save() load()??

2007-08-22 Thread Charles C. Berry
On Tue, 21 Aug 2007, Jessica Z wrote: [snip] I did not notice a comment on this bit in the other replies: newdata - load (compact_d.Rdata) summary(newdata) Length Class Mode 1 character character newdata is a string whose value is 'd' try print( newdata ) ls()

Re: [R] All subsets regression

2007-08-22 Thread Thomas Lumley
On Wed, 22 Aug 2007, Alan Harrison wrote: Hey folks, I'm trying to do all subsets on a zero-inflated poisson regression. I'm aware of the leaps and regsubsets functions but I don't know if they work for ZIP regressions or how the syntax fits in for them. They don't. -thomas

[R] integrate

2007-08-22 Thread Santanu Pramanik
Hi, I am trying to integrate a function which is approximately constant over the range of the integration. The function is as follows: my.fcn = function(mu){ + m = 1000 + z = 0 + z.mse = 0 + for(i in 1:m){ + z[i] = rnorm(1, mu, 1) + z.mse = z.mse + (z[i] - mu)^2 + } + return(z.mse/m) + }

[R] integrate

2007-08-22 Thread Santanu Pramanik
Hi, I am trying to integrate a function which is approximately constant over the range of the integration. The function is as follows: my.fcn = function(mu){ + m = 1000 + z = 0 + z.mse = 0 + for(i in 1:m){ + z[i] = rnorm(1, mu, 1) + z.mse = z.mse + (z[i] - mu)^2 + } + return(z.mse/m) + }

Re: [R] integrate

2007-08-22 Thread Duncan Murdoch
On 8/22/2007 3:54 PM, Santanu Pramanik wrote: Hi, I am trying to integrate a function which is approximately constant over the range of the integration. The function is as follows: That's not a function of the input mu. It includes a random component: my.fcn(10) [1] 0.9786558 my.fcn(10)

Re: [R] distance by vegan

2007-08-22 Thread Victor Landeiro
Hi, In vegan the function to calculate distance is vegdist in which the default distance is Sorensen (Bray-Curtis). So, try: vegdist(x, method=bray) Also see ?vegdist victor On 8/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How to calculate sorensen (bray-curtis) distance by dist

Re: [R] plotting lda results

2007-08-22 Thread Silvia Lomascolo
Thanks for trying to answer even if my question isn't very clear. Please allow me to try again with an example: I want to predict group membership by the three variables below, and then plot the results in one figure that compares the frequency of scores of both groups on the LD obtained: Group-

[R] Need a variant of rbind for datasets with different numbers of columns

2007-08-22 Thread Kirsten Beyer
Hello. I am looking for a function that will allow me to paste rows together without regard for the numbers of columns in the datasets to be joined. The only columns where it matters if they are aligned correctly are at the beginning - the rest of the columns represent differing numbers of ICD9

Re: [R] integrate

2007-08-22 Thread apjaworski
As Duncan Murdoch mentioned in his reply, the problem is with the fact that your function is not really a properly defined function in the sense of assigning a unique y to each x. The integrate function uses an adaptive quadrature routine which probably makes multiple calls to the function being

[R] triviality solved: Unwanted but added additional first column when using write.csv2()

2007-08-22 Thread Delcour Libertus
Hello! When I export a dataframe to a csv-file there is always an unwanted column added as the following demonstrates: system(cat example.csv) ID;Name;Value1;Value2 100;Tom;11,90;32,90 101;Martha;15,90;49,00 102;Ute;20,00;300,00 write.csv2(read.csv2 (example.csv), examplecopy.csv)

Re: [R] integrate

2007-08-22 Thread Santanu Pramanik
Hi Andy, Thank your very much for your input. I also tried something like that which gives a value close to 20, basically using the same trapezoidal rule. sum(apply(as.matrix(seq(-10,10,by=0.1)),1,my.fcn))*0.1 [1] 20.17385 Actually my function is much more complicated than the posted example

Re: [R] integrate

2007-08-22 Thread Ravi Varadhan
You can divide your domain of integration into smaller intervals and then add up the individual contributions. This could improve the speed of adaptive Gauss-Kronrod quadrature used in integrate(). Ravi. --- Ravi

[R] gWidgets (tcltk): problem extracting values from widgets in glayout grid

2007-08-22 Thread englund . evan
Hello, I haven't been able to find an example for the second case below -- or perhaps I didn't recognize it when I saw it. Is there a value for x such that svalue(x) will return bbb, either by itself or as part of an array? Or do I need to do something else entirely? (R2.5.1; Windows XP)

Re: [R] Need a variant of rbind for datasets with different numbers of columns

2007-08-22 Thread jim holtman
Where is the data coming from since it has a variable number of columns in each row? Is it coming from a text file? If so, you can use the fill=TRUE option when reading to fill out empty columns. You need to provide at least a subset of the data so we can see what you are working with. On

[R] degrees of freedom question

2007-08-22 Thread Greg Tarpinian
R2.3, WinXP Dear all, I am using the following functions: f1 = Phi1+(Phi2-Phi1)/(1+exp((log(Phi3)-log(x))/exp(log(Phi4))) f2 = Phi1+(Phi2-Phi1)/(1+exp((log(Phi3)-log(r)-log(x))/exp(log(Phi4))) subject to the residual weighting Var(e[i]) = sigma^2 * abs( E(y) )^(2*Delta) Here is my

Re: [R] gWidgets (tcltk): problem extracting values f rom widgets in glayout grid

2007-08-22 Thread j verzani
Dear Evan, englund.evan at epamail.epa.gov writes: Hello, I haven't been able to find an example for the second case below -- or perhaps I didn't recognize it when I saw it. Is there a value for x such that svalue(x) will return bbb, either by itself or as part of an array? Or do I

[R] two labels on x-axis (year and month)

2007-08-22 Thread mgilgen
hej i'm plotting time-series and label the x-axis as follows: r - as.POSIXct(round(range(p1$time), month)) to define the time range for labeling the xaxis plot(p1$time,p1$ p1, type=l, xaxt=n) plots p1 against time axis.POSIXct(1, at=seq(r[1], r[2], by=month), format=%m) labels the axis in