Re: [R] matrix of random variables from a matrix of means and matrix of sd

2013-05-24 Thread M M
Nice one - didn't think of the array at all as my brain was fixated on lists... Thanks, Murali > Date: Fri, 24 May 2013 21:54:22 +0100 > From: ruipbarra...@sapo.pt > To: fean...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] matrix of random variables from a matrix of means and matrix

Re: [R] Change devAskNewPage setting on Escape?

2013-05-24 Thread Prof Brian Ripley
On 24/05/2013 15:21, Ulrike Grömping wrote: Dear helpeRs, I would like to include generation of a potentially large number of plots, and modify the ask settings using the devAskNewPage function, and return it back to its original state afterwards. It is not unlikely that the user escapes from th

Re: [R] Continuous columns of matrix

2013-05-24 Thread William Dunlap
What you call "continuous" I call "cyclic" (with period NROW(x) in this case). An easy to way to deal with this is to repeat the column three times, do the original analysis, and return the results corresponding to the middle part of the repeated x. I think the following does the right thing, but

[R] Problem reading from NetCDF.

2013-05-24 Thread Simon Knapp
Hi List, I'm not sure what I'm doing wrong here and would appreciate some help. I create a NetCDF dataset as follows: library(ncdf) combined.ncdf <- with(new.env(), { nLat <- 7 nLon <- 8 nTime <- 9 missing.val <- -999 filename <- file.path(tempdir(), 'combined_d6fg4s64s6g4l.nc

Re: [R] Multinomial logistic regression

2013-05-24 Thread Duncan Mackay
Have a look at Brian Ripleys polr in library(MASS) and multinom in the library(nnet) There are other packages as well so a search will give you more choices Be careful to read the help pages carefully and make sure that you know what you are testing. HTH Duncan Duncan Mackay Department of

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Bingo!!! This time it worked Thanks arun Thankyou very much indeed.. :D Elisa > Date: Fri, 24 May 2013 17:03:33 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] Continuous columns of matrix > To: eliza_bo...@hotmail.com > CC: wdun...@tibco.com; r-help@r-project.org > > Hi, > > I c

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear Rui, i just noticed that there is one slight problem in the William' code. If you see the results of column number 4 which are [[4]] IndexValue 1 12.061959 2122.245474 where as we already dicussed that columns are continuous and 1 and 12 cant be picked together. so the

Re: [R] Pie chart

2013-05-24 Thread Jim Lemon
On 05/25/2013 06:08 AM, Jose Narillos de Santos wrote: I have a 8 Groups composed by A,B, c, D components. The Group 9 is composed by the 8 Groups but only components A and C. I want to chart a plot with 1 big plot of the total Groups (from 1 to 8) on the right and 8 mini pies on the left compo

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Thanks rui. you really are an R genius... it might have taken me 1000 years to figure it out.. thanks Elisa > Date: Fri, 24 May 2013 23:38:51 +0100 > From: ruipbarra...@sapo.pt > To: wdun...@tibco.com > CC: eliza_bo...@hotmail.com; r-help@r-project.org > Subject: Re: [R] Continuous columns of ma

Re: [R] Continuous columns of matrix

2013-05-24 Thread Rui Barradas
Hello, Just use apply(mat, 2, f) Rui Barradas Em 24-05-2013 23:25, William Dunlap escreveu: Are you trying to identify the highest point in each run of points higher than a threshold, akin to the problem of naming mountains so that each minor bump on a high ridge does not get its own name?

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear William, You loop worked well in case when i work with only one column. but wat if i have the following data. how will i do it then? structure(c(0.706461987893674, 0.998391468394261, 0.72402995269242, 1.70874688194537, 1.93906363083693, 0.89540353128442, 0.328327645695443, 0.427434603701202

Re: [R] Continuous columns of matrix

2013-05-24 Thread William Dunlap
Are you trying to identify the highest point in each run of points higher than a threshold, akin to the problem of naming mountains so that each minor bump on a high ridge does not get its own name? The following does that: f <- function (x, threshold = 0.8 * max(x), plot=FALSE) { if (plot

Re: [R] retaining comments within functions defined in Rprofile.site

2013-05-24 Thread Greg Snow
The help page "?Startup" gives details on the startup procedures and the order in which different files, variables, etc. are read/executed. That may give you insight into where to set and option so that it is in place when needed. On Fri, May 24, 2013 at 3:46 PM, Benjamin Tyner wrote: > Hi, >

[R] retaining comments within functions defined in Rprofile.site

2013-05-24 Thread Benjamin Tyner
Hi, I have some functions defined within etc/Rprofile.site which contain embedded comments, but it seems the comments get stripped out when the site profile is sourced into the base namespace. I'm thinking I need to enable options(keep.source=TRUE) somewhere prior to the actual sourcing of the sit

Re: [R] survival in R

2013-05-24 Thread Bert Gunter
It is not OK. Post to a statistical list, like stats.stackexchange.com , instead. -- Bert On Fri, May 24, 2013 at 1:55 PM, Troels Ring wrote: > Dear friends - I hope it is OK to ask a question on the principles of > survival analysis. I'm a medical person in this project, but wonders about > t

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear Rui, Regarding your last reply there is a small additional question which i want to ask. For the following column > dput(mat[,1])c(0.563879907485297, 0.749077642331436, 0.681023650957497, > 1.30140773002346, 1.46377246795771, 1.20312609775816, 0.651886452442823, > 0.853749099839423, 1.04160

[R] survival in R

2013-05-24 Thread Troels Ring
Dear friends - I hope it is OK to ask a question on the principles of survival analysis. I'm a medical person in this project, but wonders about the statistical methods proposed. We have a huge dataset and assumption of proportional hazard is said to be fulfilled if survival time is fractionate

Re: [R] matrix of random variables from a matrix of means and matrix of sd

2013-05-24 Thread Rui Barradas
Hello, The first instruction doesn't call rnorm just once but it seems more appropriate for your problem; The second instruction calls rnorm just once. set.seed(59187) res1 <- replicate(10, matrix(rnorm(4, mean = a, sd = b), ncol = 2)) set.seed(59187) res2 <- array(rnorm(40, mean = a, sd = b

Re: [R] Pie chart

2013-05-24 Thread Rui Barradas
Hello, Can you please use ?dput to post your data? The dataset you've posted doesn't make sense, you say you have 4 components but each row has 5 values, and that includes Group 9, which should have only 2 values (or 4 values with 2 zeros). Rui Barradas Em 24-05-2013 21:08, Jose Narillos de

[R] modeling outliers in arfima

2013-05-24 Thread Koopmans, Matthijs
Hello, I am analyzing a time series trajectory with many outliers. When I model the outliers using arima (TSA library), the following program statement runs like a charm: m3.m495<-arima(Rate,order=c(1,0,1),seasonal=list(order=c(1,0,1),period=5), xreg=data.frame(t74=1*(seq(Rate)==74),t107=1*(

[R] Pie chart

2013-05-24 Thread Jose Narillos de Santos
I have a 8 Groups composed by A,B, c, D components. The Group 9 is composed by the 8 Groups but only components A and C. I want to chart a plot with 1 big plot of the total Groups (from 1 to 8) on the right and 8 mini pies on the left composed by the 4 components (the size of each pie of group sh

Re: [R] xtable() with booktabs option problem

2013-05-24 Thread John Kane
i knew it was something stunningly stupid. Thanks a lot. John Kane Kingston ON Canada > -Original Message- > From: marc_schwa...@me.com > Sent: Fri, 24 May 2013 14:41:52 -0500 > To: jrkrid...@inbox.com > Subject: Re: [R] xtable() with booktabs option problem > > On May 24, 2013, at 2:3

Re: [R] xtable() with booktabs option problem

2013-05-24 Thread Marc Schwartz
On May 24, 2013, at 2:36 PM, John Kane wrote: > I could have sworn that yesterday xtable(file, booktabs = TRUE) was giving me > toprule , midrule and bottomrule outout. Today : > > library(xtable) > aa <- table( sample(letters[1:9], 100, replace = TRUE)) > xtable(aa, > booktabs = TRU

[R] xtable() with booktabs option problem

2013-05-24 Thread John Kane
I could have sworn that yesterday xtable(file, booktabs = TRUE) was giving me toprule , midrule and bottomrule outout. Today : library(xtable) aa <- table( sample(letters[1:9], 100, replace = TRUE)) xtable(aa, booktabs = TRUE) gives me \begin{table}[ht] \centering \begin{tabular}{r

Re: [R] To get the dataframe

2013-05-24 Thread arun
Lines1<- readLines(textConnection("[1] 1.000 0.000 0.3425584 0.000 [1] 1.000 0.3425584 1.6693396 0.000 [1] 1.00 1.669340 9.918513 0.00 [1]  1.00  9.918513 24.00  0.00 -- more lines- -

[R] matrix of random variables from a matrix of means and matrix of sd

2013-05-24 Thread M M
folks, if i have a matrix of means: a <- matrix(1:4, 2) and a matrix of std deviations: b <- matrix(5:8, 2) and i want to create a matrix X of random variates such that X[i, j] is a draw from normal distribution with mean = a[i, j] and std dev = b[i, j], i think i can do this? X <- matrix(rnorm(

Re: [R] R 3.0.0

2013-05-24 Thread Ben Bolker
David Winsemius comcast.net> writes: > > > On May 24, 2013, at 8:29 AM, Simmons, Susan J. wrote: > > > In the newest release of R (R 3.0.0), the "glm" package > no longer supports logistic nor probit regression. > Was this intentional? What package is best to use in the > newest version of

Re: [R] Creating an R function wrapper for a bash shell script

2013-05-24 Thread John Pellman
This is exactly what I want! Thank you very much! 2013/5/24 Greg Snow <538...@gmail.com> > Look at the 'system.file' function. > > > On Fri, May 24, 2013 at 11:27 AM, John Pellman < > john.samoylovich.pell...@gmail.com> wrote: > >> Hi! >> >> I'm trying to set up an R library for a common analys

[R] Question about Rpart function

2013-05-24 Thread puja makkar
Hello, When considering linear function where dependent variable is a function of lags of dependent variables ( co-variates are kind of auto regressive).Question is .Can i take entire data set for rpart . Then split data into training and testing and validate the model for testing data.In test

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Thankyou very very much arun.:Delisa > Date: Fri, 24 May 2013 11:08:56 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] Continuous columns of matrix > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org; ruipbarra...@sapo.pt > > Hi, > You may also try: > mat: data > > lst1<-lapply(

Re: [R] Continuous columns of matrix

2013-05-24 Thread arun
Hi, You may also try: mat: data lst1<-lapply(split(mat,col(mat)),function(x) {x1<- which(x>=0.8*max(x));x2<- which.max(x);x1[abs(x1-x2)==1|length(x)-abs(x1-x2)==1]<-NA;rbind(index=x1[!is.na(x1)],values=x[x1[!is.na(x1)]])}) names(lst1)<-NULL lst2<-apply(mat,2,function(x) do.call(rbind,fun2(x))) #

Re: [R] Creating an R function wrapper for a bash shell script

2013-05-24 Thread Greg Snow
Look at the 'system.file' function. On Fri, May 24, 2013 at 11:27 AM, John Pellman < john.samoylovich.pell...@gmail.com> wrote: > Hi! > > I'm trying to set up an R library for a common analysis that my lab does. > This analysis involves the use of an external bash script, which I would > like t

[R] Multinomial logistic regression

2013-05-24 Thread manna
Is it possible to use function "glm" in case when my outcome variable has 5 different classes? I have seen examples only when using binomial outcome variable. What about using function "multinom"? How do I to get the signifigance and the confidence levels of the coefficients and the value of goo

[R] Generating Predicted Probabilities in a Data Frame from a Logit Model

2013-05-24 Thread Abraham Mathew
I'm trying to run a logit model in R which has only one predictor. I then want to construct a data frame with the predictor values on one column and the probabilities in another column. Using LDA methodology, I'm able to do the following. # RUN LDA r <- lda(y ~ x) ## FIND AND PLOT MODEL PROBABIL

[R] Creating an R function wrapper for a bash shell script

2013-05-24 Thread John Pellman
Hi! I'm trying to set up an R library for a common analysis that my lab does. This analysis involves the use of an external bash script, which I would like to encapsulate within the R library. I have been looking at tutorials that detail how to create packages, and many of them mention an experi

Re: [R] R 3.0.0

2013-05-24 Thread Kjetil Halvorsen
I dont know of any package called "glm". Did you try ?glm Kjetil On Fri, May 24, 2013 at 5:29 PM, Simmons, Susan J. wrote: > In the newest release of R (R 3.0.0), the "glm" package no longer supports > logistic nor probit regression. Was this intentional? What package is > best to use in the

Re: [R] R 3.0.0

2013-05-24 Thread David Winsemius
On May 24, 2013, at 8:29 AM, Simmons, Susan J. wrote: > In the newest release of R (R 3.0.0), the "glm" package no longer supports > logistic nor probit regression. Was this intentional? What package is best > to use in the newest version of R to perform logistic or probit regression? > I

[R] R 3.0.0

2013-05-24 Thread Simmons, Susan J.
In the newest release of R (R 3.0.0), the "glm" package no longer supports logistic nor probit regression. Was this intentional? What package is best to use in the newest version of R to perform logistic or probit regression? [[alternative HTML version deleted]] __

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Thanks rui..That was all i wanted... Elisa > Date: Fri, 24 May 2013 17:02:56 +0100 > From: ruipbarra...@sapo.pt > To: eliza_bo...@hotmail.com > CC: b...@xs4all.nl; r-help@r-project.org > Subject: Re: [R] Continuous columns of matrix > > Hello, > > No problem. Just change <0 to >= and Inf to -Inf

Re: [R] Continuous columns of matrix

2013-05-24 Thread Rui Barradas
Hello, No problem. Just change <0 to >= and Inf to -Inf: fun2 <- function(x){ n <- length(x) imx <- which.max(x) if(imx == 1){ x[2] <- x[n] <- -Inf }else if(imx == n){ x[1] <- x[n - 1] <- -Inf }else{ x[imx -

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear Rui, I infact wanted to have something like the following.. suppose the columns are structure(c(0.706461987893674, 0.998391468394261, 0.72402995269242, 1.70874688194537, 1.93906363083693, 0.89540353128442, 0.328327645695443, 0.427434603701202, 0.591932250254601, 0.444627635494183, 1.444077

Re: [R] ggmap, hexbin and length distortion in Lat/long

2013-05-24 Thread Jeff Newmiller
I would suggest asking this on R-sig-geo. https://stat.ethz.ch/mailman/listinfo/r-sig-geo --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] When the interaction term should be interpreted in AIC table?

2013-05-24 Thread Cade, Brian
Galina: The AIC, delta AIC, and AIC weights all reference an entire model and provide no information on how you should interpret the individual parameters within a model. If you believe based on your AIC weights that the model with ZONE + LABRADOR TEA + YEAR + ZONE x LABRADOR TEA is a reasonable

Re: [R] Continuous columns of matrix

2013-05-24 Thread Rui Barradas
Hello, Something like this? fun2 <- function(x){ n <- length(x) imx <- which.max(x) if(imx == 1){ x[2] <- x[n] <- Inf }else if(imx == n){ x[1] <- x[n - 1] <- Inf }else{ x[imx - 1] <- Inf x[im

Re: [R] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Asis Hallab
Many thanks to Dirk and Brian! The tips helped me a lot. Kind regards! __ R-help@r-project.org 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,

[R] Change devAskNewPage setting on Escape?

2013-05-24 Thread Ulrike Grömping
Dear helpeRs, I would like to include generation of a potentially large number of plots, and modify the ask settings using the devAskNewPage function, and return it back to its original state afterwards. It is not unlikely that the user escapes from the long list of plots before reaching the e

Re: [R] Download data

2013-05-24 Thread David Reiner
Actually I think the one you want is 'FRED/DCOILWTICO' -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Reiner Sent: Friday, May 24, 2013 8:46 AM To: Christofer Bogaso; r-help Subject: Re: [R] Download data Quandl p

[R] ggmap, hexbin and length distortion in Lat/long

2013-05-24 Thread Mike Bock
I am working with spatial data in ggmap, generally with great success. I have a huge data set with the coordinates in NAD 83 UTM Zone 11 (meters). To map the data the coordinates were converted to Lat Long in GIS prior to use in R and ggmap/ggplot. I am using hexagonal binning to aggregate the

Re: [R] Download data

2013-05-24 Thread David Reiner
Quandl package is your friend: library(Quandl) # download and install if necessary oil <- Quandl('FRED/WCOILWTICO', type='xts') # Search the quandl.com site to make sure this is the data you want. # I just put in your text string 'WTI - Cushing, Oklahoma' and got several results which might be the

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear Rui,Thankyou very much for your help. just for my own knowledge what if want the values and index, which are less than or equal to 80% of the maximum value other than those in the neighbors?? like if maximum is in row number 5 of any column then the second maximum can be in any row other th

Re: [R] par(mfrow=c(1,3)) and postscript(file=)

2013-05-24 Thread Sarah Goslee
Probably you need to put the par() function after the postscript() function - the par changes apply only to the current device, and there's no postscript device until you start it. But since you haven't provided an example, it's impossible to be certain. Sarah On Friday, May 24, 2013, Öhagen Pat

Re: [R] Continuous columns of matrix

2013-05-24 Thread Rui Barradas
Hello, Berend is right, it's at least confusing. To get just the index of the maximum value in each column, apply(mat, 2, which.max) To get that index and the two neighbours (before and after, wraping around) if they are greater than or equal to 80% of the maximum, try fun <- function(x){

Re: [R] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Dirk Eddelbuettel
Hi Asis, On 24 May 2013 at 11:10, Asis Hallab wrote: | Dear R experts, | | recently I started developing a Rcpp package "OpenMPTest". | Within that package I want to use OpenMP, as in the following code example: | | // header file | #include | using namespace Rcpp ; | RcppExport SEXP testOpenM

[R] par(mfrow=c(1,3)) and postscript(file=)

2013-05-24 Thread Öhagen Patrik
I am printing three graphs into the same page using par(mfrow=c(1,3)) and the I want to save the file as postscript format using postscript() When input the postscript file into the manuscript the three graphs appear on separate pages. What have I missed and done wrong? Thank you in advan

Re: [R] Continuous columns of matrix

2013-05-24 Thread eliza botto
There you go!!! structure(c(0.706461987893674, 0.998391468394261, 0.72402995269242, 1.70874688194537, 1.93906363083693, 0.89540353128442, 0.328327645695443, 0.427434603701202, 0.591932250254601, 0.444627635494183, 1.44407704434405, 1.79150336746345, 0.94525563730664, 1.1025988539757, 0.94472640

Re: [R] Continuous columns of matrix

2013-05-24 Thread Berend Hasselman
On 24-05-2013, at 12:24, eliza botto wrote: > Dear useRs,If i have a matrix, say, 12 rows and 6 columns. The columns are > continuous. I want to find the index of maximum values and the actual > maximum values. The maximum values in each column are the highest values and > the values greater

Re: [R] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Prof Brian Ripley
This really is the wrong list: have you looked at the posting guide? The non-Rcpp aspects belong on R-devel. But in short, you cannot control whether the R installation supports OpenMP. 'Writing R Extensions' tells you how to set up Makevars, so the example has already been documented for you

[R] Continuous columns of matrix

2013-05-24 Thread eliza botto
Dear useRs,If i have a matrix, say, 12 rows and 6 columns. The columns are continuous. I want to find the index of maximum values and the actual maximum values. The maximum values in each column are the highest values and the values greater than or equal to 80% of the maximum value. Moreover, i

[R] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Asis Hallab
Dear R experts, recently I started developing a Rcpp package "OpenMPTest". Within that package I want to use OpenMP, as in the following code example: // header file #include using namespace Rcpp ; RcppExport SEXP testOpenMP( SEXP nThreads ) ; // cpp file SEXP testOpenMP( SEXP nThreads ) { BE

Re: [R] Error in png: unable to start png() device

2013-05-24 Thread PIKAL Petr
Hi Beside of what Uwe recommends. You probably use some cycle. Why not to use multipage pdf? I remember I once created pdf with more than 1000 pages without any problem. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On B

[R] Construct plot combination using grid without plotting and retrieving an object?

2013-05-24 Thread Johannes Graumann
Hi, I'm currently combining multiple plots using something along the lines of the following pseudo-code: library(grid) grid.newpage() tmpLayout <- grid.layout( nrow=4, ncol=2) pushViewport(viewport(layout = tmpLayout)) and than proceeding with filling the viewports ... works fine, but f