[R] Stack smashing again.

2022-04-10 Thread Rolf Turner
To all and sundry, near and far, Ivan Krylov in particular (The latter being singled out because he was so helpful the last time I asked a question on this issue. My apologies to him if I am being a pest.) I have again been beset by a "stack smashing" problem when trying to run R c

Re: [R] Stack dataframes into a matrix

2016-07-27 Thread David Winsemius
> On Jul 27, 2016, at 8:56 AM, Anamika Chaudhuri wrote: > > > Y<-matrix(1:40,ncol=2) > Y1<-Y/60 # estimates of p > > #print(Y1) > > sigma2<- > matrix(c(var(Y1[,1]),cov(Y1[,1],Y1[,2]),cov(Y1[,1],Y1[,2]),var(Y1[,2])),2,2) > #print(sigma2) > > rho<-sigma2[1,2]/sqrt(sigma2[1,1]*sigma2[2,2]) > #

Re: [R] Stack dataframes into a matrix

2016-07-27 Thread Anamika Chaudhuri
Hi David, Thanks for your response. rbind doesnot seem to work. Here is a reproducible example Y<-matrix(1:40,ncol=2) Y1<-Y/60 # estimates of p #print(Y1) sigma2<- matrix(c(var(Y1[,1]),cov(Y1[,1],Y1[,2]),cov(Y1[,1],Y1[,2]),var(Y1[,2])),2,2) #print(sigma2) rho<-sigma2[1,2]/sqrt(sigma2[1,1]*sigm

Re: [R] Stack dataframes into a matrix

2016-07-26 Thread David Winsemius
> On Jul 26, 2016, at 8:07 PM, Anamika Chaudhuri wrote: > > I have 100 datasets with 20 rows and 2 columns in each dataset. > I am looking for help to produce x and y below as 1000 X 20 matrix and then > repeat that across 100 datasets using R > > library(MASS) > library(car) >

[R] Stack dataframes into a matrix

2016-07-26 Thread Anamika Chaudhuri
I have 100 datasets with 20 rows and 2 columns in each dataset. I am looking for help to produce x and y below as 1000 X 20 matrix and then repeat that across 100 datasets using R library(MASS) library(car) set.seed(1234) library(mixtools) library(sp)

Re: [R] stack data (from rows to column)

2013-11-24 Thread arun
HI, Try:  library(reshape2)  melt(data,measure.vars=c("t1","t2"),var="ind") A.K. On Sunday, November 24, 2013 9:31 PM, Kristi Glover wrote: I was just wondering how to stack values of columns to rows. Would you give me some idea how I can stack? I just want to stack columns 2 and 3 but not

[R] stack data (from rows to column)

2013-11-24 Thread Kristi Glover
I was just wondering how to stack values of columns to rows. Would you give me some idea how I can stack? I just want to stack columns 2 and 3 but not column1. The column 1 is supposed to be repeated. I was able to stack using "stack" but I could not repeat the column 1. For example I have da

Re: [R] stack object layer names not visible

2013-05-20 Thread Uwe Ligges
On 15.05.2013 17:42, Fabio Berzaghi wrote: I use to be able to see the layer names of a RasterStack by just typing its name but now I only get this class : RasterStack dimensions : 70, 180, 12600 (nrow, ncol, ncell) resolution : 0.5, 0.5 (x, y) extent : -80, 10, 50, 85 (xmin, x

[R] stack object layer names not visible

2013-05-15 Thread Fabio Berzaghi
I use to be able to see the layer names of a RasterStack by just typing its name but now I only get this class : RasterStack dimensions : 70, 180, 12600 (nrow, ncol, ncell) resolution : 0.5, 0.5 (x, y) extent : -80, 10, 50, 85 (xmin, xmax, ymin, ymax) coord. ref. : NA If I do pl

Re: [R] Stack trace?

2011-11-10 Thread William Dunlap
e- > From: Kevin Burton [mailto:rkevinbur...@charter.net] > Sent: Thursday, November 10, 2011 7:11 AM > To: William Dunlap; 'Thomas Lumley' > Cc: 'r-help' > Subject: RE: [R] Stack trace? > > Will traceback() work in the error routine specified in try

Re: [R] Stack trace?

2011-11-10 Thread Kevin Burton
bur...@charter.net Cc: r-help Subject: RE: [R] Stack trace? > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas Lumley > Sent: Wednesday, November 09, 2011 1:53 PM > To: rkevinbur...@charter.net > Cc: r-help > Subj

Re: [R] Stack trace?

2011-11-09 Thread R. Michael Weylandt
fire, TIBCO Software > wdunlap tibco.com > >> -Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of William Dunlap >> Sent: Wednesday, November 09, 2011 3:51 PM >> To: Bert Gunter >> Cc: r-help &

Re: [R] Stack trace?

2011-11-09 Thread William Dunlap
tfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of William Dunlap > Sent: Wednesday, November 09, 2011 3:51 PM > To: Bert Gunter > Cc: r-help > Subject: Re: [R] Stack tr

Re: [R] Stack trace?

2011-11-09 Thread William Dunlap
rnings, perhaps by examining the text in conditionMessage(e). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Wednesday, November 09, 2011 3:40 PM To: William Dunlap Cc: r-help Subject: Re: [R] Stack trace? To Bill's suggestion

Re: [R] Stack trace?

2011-11-09 Thread Bert Gunter
:r-help-boun...@r-project.org] > On Behalf Of Thomas Lumley > > Sent: Wednesday, November 09, 2011 1:53 PM > > To: rkevinbur...@charter.net > > Cc: r-help > > Subject: Re: [R] Stack trace? > > > > On Thu, Nov 10, 2011 at 10:35 AM, wrote: > > > > >

Re: [R] Stack trace?

2011-11-09 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Thomas Lumley > Sent: Wednesday, November 09, 2011 1:53 PM > To: rkevinbur...@charter.net > Cc: r-help > Subject: Re: [R] Stack trace? > > On Th

Re: [R] Stack trace?

2011-11-09 Thread Thomas Lumley
On Thu, Nov 10, 2011 at 10:35 AM, wrote: > > Currently I have a for loop executing functions and at the end I get a > message like: > > There were 50 or more warnings (use warnings() to see the first 50) > > If I do what it says and type warnings(), I get 50 messages like: > > 2: In !is.na(x) & !

[R] Stack trace?

2011-11-09 Thread rkevinburton
Currently I have a for loop executing functions and at the end I get a message like: There were 50 or more warnings (use warnings() to see the first 50) If I do what it says and type warnings(), I get 50 messages like: 2: In !is.na(x) & !is.na(rowSums(xreg)) : longer object length is not a

Re: [R] Stack with factors

2010-04-01 Thread Peter Ehlers
On 2010-04-01 3:53, Ken Knoblauch wrote: Kenneth Roy Cabrera Torres une.net.co> writes: Hi R users: I found that I cannot stack() a data.frame with factors. db1<-data.frame(replicate(6,factor(sample(c("A","B"),6,replace=TRUE str(db1) db2<-stack(db1) db2 "db2" does not have any row. How can

Re: [R] Stack with factors

2010-04-01 Thread Ken Knoblauch
Kenneth Roy Cabrera Torres une.net.co> writes: > Hi R users: > I found that I cannot stack() a data.frame with factors. > db1<-data.frame(replicate(6,factor(sample(c("A","B"),6,replace=TRUE > str(db1) > db2<-stack(db1) > db2 > "db2" does not have any row. > How can I stack them by the variable

[R] Stack with factors

2010-04-01 Thread Kenneth Roy Cabrera Torres
Hi R users: I found that I cannot stack() a data.frame with factors. db1<-data.frame(replicate(6,factor(sample(c("A","B"),6,replace=TRUE str(db1) db2<-stack(db1) db2 "db2" does not have any row. How can I stack them by the variables X1,X2,...,X6? Thank you for your help. Kenneth

Re: [R] Stack type

2010-03-02 Thread Gabor Grothendieck
Here is an example using proto based on converting Duncan's example: library(proto) Stack <- proto(new = function(.) proto(Stack, stack = NULL, push = function(., el) .$stack <- c(list(el), .$stack), pop = function(.) { stopifnot(length(.$stack) > 0) out <-

Re: [R] Stack type

2010-03-01 Thread Duncan Murdoch
On 01/03/2010 7:56 PM, Worik R wrote: How can I implement a stack in R? I want to push and pop. Every thing I push and pop will be the same type, but not necessarily an atomic type. Use lexical scoping: stack <- function() { store <- list() push <- function(item) { store <<- c(list(i

[R] Stack type

2010-03-01 Thread Worik R
How can I implement a stack in R? I want to push and pop. Every thing I push and pop will be the same type, but not necessarily an atomic type. cheers Worik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] "stack imbalance in ..." when loading a workspace

2010-01-21 Thread Duncan Murdoch
On 21/01/2010 4:41 AM, Tal Galili wrote: Hi all, I just failed in loading a saved wordspace (13MB of size), and received these errors: Those messages indicate an internal error in R or a package that it's using. If you can make such things reproducible, you should report them as bugs, eithe

Re: [R] "stack imbalance in ..." when loading a workspace

2010-01-21 Thread Tal Galili
For some reason it now loads properly. I tried it in several ways and wasn't able to reproduce the problem. Sorry! Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) |

[R] "stack imbalance in ..." when loading a workspace

2010-01-21 Thread Tal Galili
Hi all, I just failed in loading a saved wordspace (13MB of size), and received these errors: Warning: stack imbalance in 'missing', 52 then 51 Warning: stack imbalance in 'if', 50 then 53 Warning: stack imbalance in 'as.environment', 57 then 59 Warning: stack imbalance in 'ls', 54 then 53 Warni

Re: [R] Stack overflow in R 2.10.0 with sub() and gsub() SOLVED!

2009-10-28 Thread Kenneth Roy Cabrera Torres
Thanks to Dr. Ripley and Dr. Murdoch for the workaround and the solution to the problem with sub() and gsub() memory problem. Now, with the perl=TRUE option added it works perfect (with the full database)! alumnos$AL_NUME_ID<-gsub("(^ +)|( +$)","",alumnos$AL_NUME_ID,perl=TRUE) I am going to test

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Kenneth Roy Cabrera Torres
El mar, 27-10-2009 a las 10:47 -0700, Phil Spector escribió: > What happens if you type > > Sys.setlocale('LC_ALL','C') > > before using gsub or grep? When I do that, R hangs and don't show any message. > > - Phil Spector >

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Kenneth Roy Cabrera Torres
Thank you very much for your interest. I make this: x <- as.character(alumnos$AL_NUME_ID) x <- x[-seq_len(length(x)/2)] save(x, file="x.RData") I exit form R, and then restart R and I make this: load("x.RData") y <- gsub("(^ +)|( +$)","",x) It shows me: Error en gsub("(^ +)|( +$)", "", x) :

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Duncan Murdoch
On 10/27/2009 1:05 PM, Kenneth Roy Cabrera Torres wrote: Thank you very much for your interest. I make this: x <- as.character(alumnos$AL_NUME_ID) x <- x[-seq_len(length(x)/2)] save(x, file="x.RData") I exit form R, and then restart R and I make this: load("x.RData") y <- gsub("(^ +)|( +$)",""

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Duncan Murdoch
On 10/27/2009 10:46 AM, Kenneth Roy Cabrera Torres wrote: Dr. Murdoch: I am puzzled! As you adviced me I do this: x <- as.character(alumnos$AL_NUME_ID) x <- x[-seq_len(length(x)/2)] Please try the following. After doing the lines above, do save(x, file="x.RData") and exit from R. Then re

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Kenneth Roy Cabrera Torres
Dr. Murdoch: I am puzzled! As you adviced me I do this: x <- as.character(alumnos$AL_NUME_ID) x <- x[-seq_len(length(x)/2)] y <- gsub("(^ +)|( +$)","",x) And it fails, But, trying to locate the problem I do: x <- as.character(alumnos$AL_NUME_ID) x <- x[-seq_len(length(x)/2)] x <- x[seq_len(len

Re: [R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Duncan Murdoch
On 10/27/2009 8:15 AM, Kenneth Roy Cabrera Torres wrote: Hi R developers: Congratulations for the new R 2.10.0 version. It is a huge effort! Thank you for your work and dedication. I just want to ask how to make this "strip blank" function to work again (it works on R.2.9.2). alumnos$AL_NUME_

[R] Stack overflow in R 2.10.0 with sub()

2009-10-27 Thread Kenneth Roy Cabrera Torres
Hi R developers: Congratulations for the new R 2.10.0 version. It is a huge effort! Thank you for your work and dedication. I just want to ask how to make this "strip blank" function to work again (it works on R.2.9.2). alumnos$AL_NUME_ID<-sub("(^ +)|( +$)","",alumnos$AL_NUME_ID),) "alumnos" i

Re: [R] stack overflow when loading workspace

2009-09-12 Thread Uwe Ligges
sebed1110-div...@yahoo.fr wrote: Dear all, I can't load my workspace of 25Mo on R version 2.9.2, because of a stack overflow. But I saved it normally (save.image()), and I didn't get any notification... Does anyone know what that can be due to? Is there any limitation of number of objects (

[R] stack overflow when loading workspace

2009-09-12 Thread sebed1110-divers
Dear all, I can't load my workspace of 25Mo on R version 2.9.2, because of a stack overflow. But I saved it normally (save.image()), and I didn't get any notification... Does anyone know what that can be due to? Is there any limitation of number of objects (+/-63000)? Thanks Edwige Polus.

Re: [R] STACK

2009-04-01 Thread baptiste auguie
perhaps, unlist(d, use.names=F) baptiste On 1 Apr 2009, at 22:15, oscar linares wrote: Dear Rxperts I have a data.frame as follows ABCD 14 710 25 811 36 912 I want to convert it to a data frame with a single row (i.e., stack the columns w

[R] STACK

2009-04-01 Thread oscar linares
Dear Rxperts I have a data.frame as follows ABCD 14 710 25 811 36 912 I want to convert it to a data frame with a single row (i.e., stack the columns without the heading) 1 2 3 4 5 6 7 8 9 10 11 12 Any suggestions please. Thanks in advance! --

[R] stack data sets

2009-01-28 Thread Nidhi Kohli
Hi All, I'm generating 10 different data sets with 1 and 0 in a matrix form and writing the output in separate files. Now I need to stack all these data sets in one vector and I know that stack only operates on list or data frame however I got these data sets by converting list to a matrix so c

Re: [R] stack or dissolve matrix without double entries

2008-10-09 Thread jim holtman
Is this what you want: > x <- matrix(1:16,4) > rownames(x) <- colnames(x) <- LETTERS[1:4] > x A B C D A 1 5 9 13 B 2 6 10 14 C 3 7 11 15 D 4 8 12 16 > require(reshape) > # create single list > z <- melt(x) > z X1 X2 value 1 A A 1 2 B A 2 3 C A 3 4 D A 4 5 A B

[R] stack or dissolve matrix without double entries

2008-10-09 Thread Marten Winter
Heja, I've some bigger distance-matrices like this: num [1:3231, 1:3231] 0.000 0.176 0.176 0.176 0.176 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:3231] "A" "B" "C" "D" ... ..$ : chr [1:3231] A" "B" "C" "D" . I actually want to convert them into a 2 column dataframe like this: data.f

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Thanks Jim! On 12/31/07, jim holtman <[EMAIL PROTECTED]> wrote: > > To make the charts the same size, try setting the top and bottom > margins to be the same; e.g., > > layout(rbind(1,2)) > par(mar=c(0,4,4,2)) > plot(rnorm(1:3),xaxt="n",xlab="") > par(mar=c(4,4,0,2)) > plot(rnorm(1:3)) > > On Dec

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Sorry Gabor, you are right, using mar= alone is enough to do the stacking. I was wrong. On 12/31/07, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Gabor. mar= and oma= by themselves won't be able to do it. layout() > is necessary per Jim's post. But now I am stuck with another problem when I > t

Re: [R] stack charts right on top of each other

2007-12-31 Thread jim holtman
To make the charts the same size, try setting the top and bottom margins to be the same; e.g., layout(rbind(1,2)) par(mar=c(0,4,4,2)) plot(rnorm(1:3),xaxt="n",xlab="") par(mar=c(4,4,0,2)) plot(rnorm(1:3)) On Dec 31, 2007 1:16 PM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Jim! It seems layout(

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Thanks Gabor. mar= and oma= by themselves won't be able to do it. layout() is necessary per Jim's post. But now I am stuck with another problem when I tried to define the height of each chart: layout(rbind(1,2)) par(mar=c(0,4,4,2),pin=c(4,2)) plot(rnorm(1:3),xaxt="n",xlab="") par(mar=c(5,4,0,2),pi

Re: [R] stack charts right on top of each other

2007-12-31 Thread Gabor Grothendieck
Check out: http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm On Dec 31, 2007 11:53 AM, tom soyer <[EMAIL PROTECTED]> wrote: > Hi, > > I tried to stack two charts on top of each other using the following > R functions: > > par(mfrow=c(2,1)) > plot(rnorm(1:3),xaxt="n",xla

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Thanks Jim! It seems layout() is necessary in addition to mar=. I have a follow up question: is there a way to specify the height of each chart so that all the charts have the same height? I tried pin=, but it created more space (if the height is set to a small value) between the charts, although i

Re: [R] stack charts right on top of each other

2007-12-31 Thread Uwe Ligges
See ?par and its argument "mar" Uwe Ligges tom soyer wrote: > Hi, > > I tried to stack two charts on top of each other using the following > R functions: > > par(mfrow=c(2,1)) > plot(rnorm(1:3),xaxt="n",xlab="") > plot(rnorm(1:3)) > > This created two charts, one on top of the other, but the

Re: [R] stack charts right on top of each other

2007-12-31 Thread jim holtman
try this to get them to butt up against each other: layout(rbind(1,2)) par(mar=c(0,4,3,2)) plot(rnorm(1:3),xaxt="n",xlab="") par(mar=c(4,4,0,2)) plot(rnorm(1:3)) On Dec 31, 2007 11:53 AM, tom soyer <[EMAIL PROTECTED]> wrote: > Hi, > > I tried to stack two charts on top of each other using the fol

[R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Hi, I tried to stack two charts on top of each other using the following R functions: par(mfrow=c(2,1)) plot(rnorm(1:3),xaxt="n",xlab="") plot(rnorm(1:3)) This created two charts, one on top of the other, but there is too much space between them. Does anyone know how to elimiate the space in bet