[R] How to repeat vectors ?

2006-09-30 Thread Tong Wang
Hi, If I have a matrix , say a11 a12 a21 a22 Is there a routine to get: a11 a12 a11 a12 a21 a22

Re: [R] How to repeat vectors ?

2006-09-30 Thread Tong Wang
I just figured out a way to do this: rep.vec - function(X,n)return(t(array(rep(X,n),c(length(X),n Then,apply(MyMatrix, 2, rep.vec,2) Is there a better way ? Is there an internal function to repeat a vector or matrix ? Thanks a lot. - Original Message -

Re: [R] strange warning message

2006-09-30 Thread Duncan Murdoch
On 9/30/2006 1:00 AM, Tong Wang wrote: Hi Duncan: Thank you for your help last time, since I do not use NULL to indicate empty enviroment, I think I'm fine. And yes, I did upgrade my R version recently, but how comes I still get this warning for new files created and saved after

Re: [R] if then else

2006-09-30 Thread Uwe Ligges
[EMAIL PROTECTED] wrote: What is the correct form to write statement meaning: if (a==1) {b=2; c=3}; else {b=0; c=0}; if (a==1) {b=2; c=3} else {b=0; c=0}; ;-) Uwe Ligges Thank you Jue Wang, Biostatistician Contracted Position for Preclinical Research Biostatistics PrO

Re: [R] How to repeat vectors ?

2006-09-30 Thread Alex Brown
Solution: m[rep(1:nrow(m),each=2),] Explanation: There is a simple and effective way to do this, using array slices. for your input matrix, m: m=matrix(paste(a,c(11,12,21,22),sep=),2) m [,1] [,2] [1,] a11 a21 [2,] a12 a22 you want to create [,1] [,2] [1,] a11 a21 [2,] a11

Re: [R] if then else

2006-09-30 Thread Jim Lemon
[EMAIL PROTECTED] wrote: What is the correct form to write statement meaning: if (a==1) {b=2; c=3}; else {b=0; c=0}; if (a==1) {b=2; c=3} else {b=0; c=0}; Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] How to repeat vectors ?

2006-09-30 Thread Adrian DUSA
Maybe this one? MyMatrix - matrix(1:4, nrow=2) MyMatrix [,1] [,2] [1,]13 [2,]24 MyMatrix[rep(seq(nrow(MyMatrix)), each=2), ] [,1] [,2] [1,]13 [2,]13 [3,]24 [4,]24 HTH, Adrian On Saturday 30 September 2006 09:33, Tong Wang wrote: I

Re: [R] How to repeat vectors ?

2006-09-30 Thread Gabor Grothendieck
Here are 4 approaches in order from most compact to least. #1 only works for numeric matrices, # 2 is a shorter versio of your solution using rep.vec and # 3 is from Alex's post and is likely what I would use in practice. m - matrix(1:4, 2) # test matrix # 1 - m must be numeric for this one to

[R] autologistic model? - what package?

2006-09-30 Thread Sara Mouro
Dear all, Could you pleas advise me on the following? I need to use general(ized) linear models (binomial distribution + logit link function) , to describe the preferred environment of each species (each sample is an individual in which I have measured several variables and also recorded

Re: [R] Heteroskedasticity test

2006-09-30 Thread Achim Zeileis
On Fri, 29 Sep 2006, Alberto Monteiro wrote: Is there any heteroskedasticity test in the package? Something that would flag a sample like x - c(rnorm(1000), rnorm(1000, 0, 1.2)) The package lmtest contains several tests for heteroskedasticity, in particular the Breusch-Pagan test (and also

[R] Textmate project drawer: is there a Windows alternative?

2006-09-30 Thread Graham Smith
I was reading about the project drawer feature in Textmate, which is Mac only. Is there a similar feature in a Windows based text editor that works with R. This feature sounds really useful. Thanks, Graham [[alternative HTML version deleted]]

Re: [R] autologistic model? - what package?

2006-09-30 Thread Roger Bivand
On Sat, 30 Sep 2006, Sara Mouro wrote: Dear all, Could you pleas advise me on the following? I need to use general(ized) linear models (binomial distribution + logit link function) , to describe the preferred environment of each species (each sample is an individual in which I have

[R] only need the p-value

2006-09-30 Thread Boks, M.P.M.
Dear R users, I am calculating several cox proportional hazard models after each other (I know this is unusual, but I am just exploring the data). For the purpose of multiple testing correction I need to construct an array of these p-values. However since the output is not an array in

Re: [R] Build error on Windows

2006-09-30 Thread Duncan Murdoch
On 9/29/2006 5:41 PM, Pankaj Savdekar wrote: Thanks for the quick reply. On 9/29/2006 8:53 AM, Pankaj Savdekar wrote: Hi, I'm trying to build R-2.3.1 on windows, but make gives me following error while building pkg-base: -- Making package base adding build stamp

Re: [R] if then else

2006-09-30 Thread Duncan Murdoch
On 9/30/2006 6:29 AM, Uwe Ligges wrote: [EMAIL PROTECTED] wrote: What is the correct form to write statement meaning: if (a==1) {b=2; c=3}; else {b=0; c=0}; if (a==1) {b=2; c=3} else {b=0; c=0}; That's valid, but is it correct form? The semicolon at the end is not needed. I'd say

Re: [R] Textmate project drawer: is there a Windows alternative?

2006-09-30 Thread Duncan Murdoch
On 9/30/2006 8:38 AM, Graham Smith wrote: I was reading about the project drawer feature in Textmate, which is Mac only. Is there a similar feature in a Windows based text editor that works with R. This feature sounds really useful. If you don't get an answer, it would probably be a good

Re: [R] Textmate project drawer: is there a Windows alternative?

2006-09-30 Thread Graham Smith
Duncan, That seems a good idea :-) Project drawer appears to be a side panel in TextMate with folders where you can drop and drag R output and code into, not sure about graphic output, but that would also be useful. Each folder representing a particular project - hence the name. Graham On

Re: [R] if then else

2006-09-30 Thread Uwe Ligges
Duncan Murdoch wrote: On 9/30/2006 6:29 AM, Uwe Ligges wrote: [EMAIL PROTECTED] wrote: What is the correct form to write statement meaning: if (a==1) {b=2; c=3}; else {b=0; c=0}; if (a==1) {b=2; c=3} else {b=0; c=0}; That's valid, but is it correct form? The semicolon at the end is

Re: [R] only need the p-value

2006-09-30 Thread Ritwik Sinha
This is how you go about doing this. summary(results)$coefficients[1,5] You will have to check this for you code. But the idea is that summary(results) is a list (?) and one of its components is called coefficients, which is a matrix. So the problem is just to extract one element of this matrix.

[R] Print/Save/Cat/Write list

2006-09-30 Thread Ritwik Sinha
Hi, I would like to write a list to an ascii file. I tried the following y - list(a = 1, b = c(TRUE,FALSE), c = oops) save(y, file=y.data, ascii=TRUE) # Not satisfactory print does not have a file= option cat cannot handle lists. write does not handle lists write.table converts it to a d.f

Re: [R] Print/Save/Cat/Write list

2006-09-30 Thread jim holtman
try: sink(y.data) y sink() On 9/30/06, Ritwik Sinha [EMAIL PROTECTED] wrote: Hi, I would like to write a list to an ascii file. I tried the following y - list(a = 1, b = c(TRUE,FALSE), c = oops) save(y, file=y.data, ascii=TRUE) # Not satisfactory print does not have a file= option cat

Re: [R] Print/Save/Cat/Write list

2006-09-30 Thread Rolf Turner
?sink __ 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 provide commented, minimal, self-contained, reproducible code.

Re: [R] Print/Save/Cat/Write list

2006-09-30 Thread Ritwik Sinha
thanks. Ritwik. On 9/30/06, jim holtman [EMAIL PROTECTED] wrote: try: sink(y.data) y sink() On 9/30/06, Ritwik Sinha [EMAIL PROTECTED] wrote: Hi, I would like to write a list to an ascii file. I tried the following y - list(a = 1, b = c(TRUE,FALSE), c = oops) save(y,

Re: [R] Heteroskedasticity test

2006-09-30 Thread Ritwik Sinha
you may also try to levene test. Once again i think it is for a known change point. http://finzi.psych.upenn.edu/R/library/car/html/levene.test.html On 9/30/06, Achim Zeileis [EMAIL PROTECTED] wrote: On Fri, 29 Sep 2006, Alberto Monteiro wrote: Is there any heteroskedasticity test in the

Re: [R] Print/Save/Cat/Write list

2006-09-30 Thread Gabor Grothendieck
Check out ?dput On 9/30/06, Ritwik Sinha [EMAIL PROTECTED] wrote: Hi, I would like to write a list to an ascii file. I tried the following y - list(a = 1, b = c(TRUE,FALSE), c = oops) save(y, file=y.data, ascii=TRUE) # Not satisfactory print does not have a file= option cat cannot

[R] plotting

2006-09-30 Thread Anupam Tyagi
Is there something in R that will display both observed values and their influence on calculated statistics? Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] a decimal aligned column

2006-09-30 Thread BBands
As requested: The alignment problem came from calling format many times. Marc Schwartz suggested a solution of putting my results in a vector and then formatting. As I understand it the problem is that fixed-width fields are only available from sprintf, while comma delineation is only available

[R] Gradient problem in nlm

2006-09-30 Thread singyee ling
Hello everyone! I am having some trouble supplying the gradient function to nlm in R for windows version 2.2.1. What follows are the R-code I use: fredcs39-function(a1,b1,b2,x){return(a1+exp(b1+b2*x))} loglikcs39-function(theta,len){

Re: [R] a decimal aligned column

2006-09-30 Thread Gabor Grothendieck
For the last line you could also consider the print.data.frame method: data.frame(Symbol = symbols, dolVol = dolVol.pretty) or data.frame(row.names = symbols, dolVol = dolVol.pretty) capture.output or sink could be used if you want to direct it to a file. On 9/30/06, BBands [EMAIL

[R] Setting NA

2006-09-30 Thread Anupam Tyagi
Is there a way to set NA values in R, without changing the dataframe? I would like to use different combinations of non-response values, as if they were NA for some of the computations. I don't want to change the dataframe each time I have to do this? Anupam.

Re: [R] Need help to estimate the Coef matrices in mAr

2006-09-30 Thread Spencer Graves
I'm sorry, but I can't follow what you are asking. If you'd like more help, please provide commented, minimal, self-contained, reproducible code, as suggested in the posting guide www.R-project.org/posting-guide.html. http://www.R-project.org/posting-guide.html Please include a minimal

Re: [R] Setting NA

2006-09-30 Thread David Barron
Would using the subset argument that is available in many functions (eg lm) achieve what you want? On 30/09/06, Anupam Tyagi [EMAIL PROTECTED] wrote: Is there a way to set NA values in R, without changing the dataframe? I would like to use different combinations of non-response values, as if

[R] package e1071 - class probabilities

2006-09-30 Thread David Meyer
Vince: the implementations for both are different, so this might happen (although undesirably). Can you provide me an example with data (off-list)? David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] fitting a gaussian to some x,y data

2006-09-30 Thread H. Paul Benton
Michael, I'm also playing with the nls function trying to get it to work with a Gaussian. My lines that I have at the moment and I hope will help you are class(fo - (x ~ (A/(sig*sqrt(2*pi)))* exp(-1*((bin-mu)^2/(2* sig^2) nls.AB - nls(fo,data=freq.tab, start=

Re: [R] strange warning message

2006-09-30 Thread Duncan Murdoch
On 9/30/2006 3:31 PM, John C Frain wrote: I get a similar message when i start Sciviews R console. I do not get the message when I start R directly or through Tinn-r . If I load the libraries one by one the message is returned after svViews is loaded. I presume there is some problem with

[R] Inner product

2006-09-30 Thread Sonal Darbari
Hi, How do we find out the inner product norm of eigen vectors in R? Lets say we have eigen vectors : x1 = 1,2,3 and x2 = 2,-3,4 are there any functions buit in R which directly calculate the inner product norm of vectors? Thanks, Sonal. [[alternative HTML version deleted]]

[R] error from pmvnorm

2006-09-30 Thread yonghai
Hi all, Can anyone tell me what the following error message means? Error in mvt(lower = lower, upper = upper, df = 0, corr = corr, delta = mean, : NA/NaN/Inf in foreign function call (arg 6) It was generated when I used the 'pmvnorm' function in the 'mvtnorm' package. Thanks a lot. Yonghai

Re: [R] Inner product

2006-09-30 Thread David Barron
For inner product see ?%*%. There is a norm function in the Matrix package. On 30/09/06, Sonal Darbari [EMAIL PROTECTED] wrote: Hi, How do we find out the inner product norm of eigen vectors in R? Lets say we have eigen vectors : x1 = 1,2,3 and x2 = 2,-3,4 are there any functions buit

[R] [R-pkgs] Reshape version 0.7.1

2006-09-30 Thread hadley wickham
Reshape version 0.7.1 = Reshape is an R package for flexibly restructuring and aggregating data. It's inspired by Excel's pivot tables, and it (hopefully) makes it very easy to get your data into the shape that you want. You can find out more at http://had.co.nz/reshape

Re: [R] Inner product

2006-09-30 Thread Peter Dalgaard
David Barron [EMAIL PROTECTED] writes: For inner product see ?%*%. There is a norm function in the Matrix package. Or crossprod(). Notice that this gives _squared_ norms when applied to a single vector. On 30/09/06, Sonal Darbari [EMAIL PROTECTED] wrote: Hi, How do we find out the

[R] counting a sequence of charactors or numbers

2006-09-30 Thread Joe Byers
I have the following sequence of characters. These could be integers as well. For this problem, only two values are valid. S S S S S S W W W W W W W W S S S S S S S S W W W W W W W W S S S S S S S S S S S S S W W W W W W W W W I need to determine the count of the classes/groups in sequence.

Re: [R] counting a sequence of charactors or numbers

2006-09-30 Thread roger koenker
?rle url:www.econ.uiuc.edu/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Sep 30, 2006,

Re: [R] problems with R and tckl/tk on Mac OS X

2006-09-30 Thread Bill Northcott
On 30/09/2006, at 8:00 PM, Rob J Goedman wrote: Thanks for catching this question. I'd missed Ingo's original email. Rcmdr does need X.11 and Tcl/Tk, although it uses the versions that come with Mac OS 10.4. Hence, as Alex indicates, there is no need to separately install these. Ingo, if

Re: [R] How to repeat vectors ?

2006-09-30 Thread Gabor Grothendieck
Here are some timings. From fastest to slowest we have: #3, #4, #1, #2 so, yes, the apply approach, even with the improvement (#2), is the slowest and, in fact, on this test is an order of magnitude slower than #3 which is the fastest one. m - matrix(1:4, 200) # test matrix # 1 - m must

[R] Can I avoid loops here ?

2006-09-30 Thread Tong Wang
Hi, I have two lists of matrices, and I would like to get a list of term by term product, say, mylist1- list( X1,X2); mylist2-list(Y1,Y2) Need: mylist3-list(X1%*%Y1,X2%*%Y2) Is there a way that allows me to do this without loops ? Thanks a lot. best

Re: [R] Can I avoid loops here ?

2006-09-30 Thread Gabor Grothendieck
Try: mapply(%*%, mylist1, mylist2, SIMPLIFY = FALSE) Please provide self-contained examples as requested on the last line of every message to r-help. That means the data for X1, X2, Y1, Y2 should be included so one can run the code you post. On 10/1/06, Tong Wang [EMAIL PROTECTED] wrote: Hi,