[R] VEGAN ordistep, stepwise model selection in CCA - familywise error correction.

2012-06-09 Thread Nevil Amos
I am using VEGAN ordistep function for stepwise model selection. By default the Pin and Pout values are set to .05 and .1 Is it appropriate to use a family wise correction ( such as bonferroni or one of the alternatives) to adjust these values where there are several (5-10), potentially correla

Re: [R] How to see the implementation of print function for a class from a package?

2012-06-09 Thread Majid Einian
I am working on the package "datation" and it is not on CRAN. On Sun, Jun 10, 2012 at 8:28 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > I presume your problem is that you are looking for non-exported > methods in some unstated package. > > Generally the pattern is something like

Re: [R] How to see the implementation of print function for a class from a package?

2012-06-09 Thread R. Michael Weylandt
I presume your problem is that you are looking for non-exported methods in some unstated package. Generally the pattern is something like this methods(plot) # shows all plot.* methods methods(class = "lm") # shows all *.lm methods Those marked with a star are not exported but you can get at the

[R] How to see the implementation of print function for a class from a package?

2012-06-09 Thread Majid Einian
Dear R-helpers, I want to see the code used when printing (using print(object) or by just typing the object name) for a class from a package. I can see the summary code using packagename::summary.classname but nothing for print method and also plot methods. In general, how can I see the COMPLETE c

[R] lmer function in R

2012-06-09 Thread Gary Dong
Dear R users, I'm estimating a two-level regresion model but having difficuly in finding a good R syntax example. Let me use an example to explain what I'm doing. The dependent variable is math score (mathscore). Predictors are at two levels. At the student level, they are household income (hinc)

Re: [R] mvrnorm limits

2012-06-09 Thread David Winsemius
On Jun 9, 2012, at 11:00 PM, Andras Farkas wrote: Dear All, I am using the following commands to generate a given dataset: a <-c(0.348,0.007,0.503,0.58,0.21) cov <- c (0.0448,0,0,0,0,0.0001,0.0001,0,0,0 ,-0.0055 ,-0.0005,0.0495,0,0,0.0218,0.0009 ,-0.0253,0.1103,0,-0.0102,-0.0007,0.00631,

Re: [R] combining different types of graphics (scatterplots, boxplots) using lattice

2012-06-09 Thread David Winsemius
On Jun 9, 2012, at 5:07 PM, wcheckle wrote: Dear R users: I have a continuous outcome variable and four predictors, two continuous and two dichotomous. i would like to use the lattice plot to create scatter plots for the continuous predictors and boxplots for the dichotomous predictors.

[R] mvrnorm limits

2012-06-09 Thread Andras Farkas
Dear All,   I am using the following commands to generate a given dataset:   a <-c(0.348,0.007,0.503,0.58,0.21) cov <-c(0.0448,0,0,0,0,0.0001,0.0001,0,0,0,-0.0055,-0.0005,0.0495,0,0,0.0218,0.0009,-0.0253,0.1103,0,-0.0102,-0.0007,0.00631,0.0067,0.0132) b <-matrix(cov,nrow=5, ncol = 5, byrow = TRUE,

Re: [R] Re : Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"

2012-06-09 Thread RobMusk
Thanks Pascal, but all my packages are current. That is not the problem. Regards, -- View this message in context: http://r.789695.n4.nabble.com/Matrix-package-loading-problem-Error-object-kronecker-is-not-exported-by-namespace-methods-tp4632861p4632911.html Sent from the R help mailing list arc

Re: [R] importing multiple file form folder

2012-06-09 Thread Rui Barradas
Hello, 'cbind' means column bind and 'rbind', row bind. So, apparently, all you have to do is replace one letter. ONLY in the do.call, it will surelly do what you want, my only doubt is with cbinding the Length column, it should recycle the values. Hope this helps, Rui Barradas Em 09-06-2012

Re: [R] importing multiple file form folder

2012-06-09 Thread mpavlic
Hi all, i managed to (with the help of most posts here) using bellow code : >setwd("C:/Users/mpavlic/Desktop/test") >txt_files = list.files(pattern = '*.ddf'); >flist<-txt_files >flistNew <- sub("^channel 1 ([0-9 ]+).*", "\\1", flist) >coordinate<-read.cs

[R] combining different types of graphics (scatterplots, boxplots) using lattice

2012-06-09 Thread wcheckle
Dear R users: I have a continuous outcome variable and four predictors, two continuous and two dichotomous. i would like to use the lattice plot to create scatter plots for the continuous predictors and boxplots for the dichotomous predictors. with 4 continuous variables, this is what i have been

[R] how to compare different types of graphics in R

2012-06-09 Thread wcheckle
Dear R users: I have a continuous outcome variable and four predictors, two continuous and two dichotomous. i would like to use the lattice plot to create scatter plots for the continuous predictors and boxplots for the dichotomous predictors. with 4 continuous variables, this is what i have been

Re: [R] Reshaping columns

2012-06-09 Thread arun
Hi, Try this:  dat1<- read.table(text="  V1    V2  8098    11  9099    001100  0023    110011  6545    11  ",sep="",colClasses=c(V1="character",V2="character"),header=TRUE) dat2<-as.data.frame(apply(dat1,2,FUN=function(x){do.call(rbind,strsplit(x,""))})$V2) dat2<-data.frame(V1=dat1$V

[R] suppress output of makeCluster()

2012-06-09 Thread zerfetzen
I'm trying to suppress the output of: makeCluster(detectCores()) and haven't had luck. So far, I've tried invisible, sink, and capture.output. Any ideas are appreciated. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/suppress-output-of-makeCluster-tp4632904.html Sent f

Re: [R] Help with permutation function from Turner et al. 2010 (Ecology)

2012-06-09 Thread mlcollyer
Dear Ashley, I am one of the co-authors for these scripts. I just downloaded the example files from the ESA archives and ran in naively on some data and it worked fine. My guess is that the problem lies in a portion of the script that you did not provide. If I had to be more certain with my gue

Re: [R] Applying a function to a column of a data frame

2012-06-09 Thread David Winsemius
On Jun 9, 2012, at 1:02 PM, Onur Uncu wrote: Thank you Michael. One follow up question: In the solution using apply(), why are we feeding x[2] inside testfun instead of x[[2]]? Aren't we supposed to feed the vector of values to the function, which is achieved by x[[2]]? `apply` sends the colu

Re: [R] Applying a function to a column of a data frame

2012-06-09 Thread Onur Uncu
Thank you Michael. One follow up question: In the solution using apply(), why are we feeding x[2] inside testfun instead of x[[2]]? Aren't we supposed to feed the vector of values to the function, which is achieved by x[[2]]? Thnks. On Sat, Jun 9, 2012 at 3:38 PM, R. Michael Weylandt wrote: > N

Re: [R] caret: compare linear models of different degree

2012-06-09 Thread Dominik Bruhn
Max, thanks for your answer! > predict.train() will handle the formulas. If you want to compare the > models in terms of their predictive performance, set the seeds prior > to running the model. This will ensure that the same resampling > indices are used in train(). If you do this, the resamples()

Re: [R] Legend: Custom distance between lines and text

2012-06-09 Thread Sebastian Schubert
On 09/06/12 13:20, peter dalgaard wrote: >> I guess I overlook the corresponding part in the manual but how can I >> modify the distance between the text and the line in a legend? >> >> Thank you for any hints! > > You mean like this? > > plot(0) > legend(1, .5, legend=c("foo","bar"), lty=1:2, pc

Re: [R] Help with permutation function from Turner et al. 2010 (Ecology)

2012-06-09 Thread Uwe Ligges
On 09.06.2012 03:57, Ashley Stasko wrote: Hello, I'm using R code that includes a residual permutation that was written as a supplement to the paper: Turner et al. 2010. A general hypothesis-testing framework for stable isotopes ratios in ecological studies. Ecology 91:2227-2233. The supple

Re: [R] preserving date formats in functions

2012-06-09 Thread Uwe Ligges
On 05.06.2012 21:44, jween wrote: Hi there! I have two date columns in a dataframe I need to selectively collapse based on missing values and which date comes first (imported from an text file). This is what I did: RHSSP$CT<- as.POSIXct(RHSSP$CT, format='%m/%d

Re: [R] load coda in BRugs to perfor diagnostics

2012-06-09 Thread Uwe Ligges
On 05.06.2012 18:30, Guillaume2883 wrote: Dear all, I just wrote a script to have each of my three mcmc chins running on a different computer core to improve computation speed. To do it I use the function sfLapply from the package snowfall. Before using parallell computation, I did my diagnost

[R] caret: compare linear models of different degree

2012-06-09 Thread Dominik Bruhn
I want to use the caret package to train linear models. I want to compare these models when using different degrees (aka degrees of interaction). This is possible for the 'earth' method (using the '.degree' parameter) but I found no possibility of customizing the degree for the 'lm' method. This mi

Re: [R] help with rle function on paired data

2012-06-09 Thread William Dunlap
> ldiff <- function(x)c(TRUE, x[-1]!=x[-length(x)]) # "logical" diff function > d[ldiff(d$DataValue), ] ElpsdTime DataValue 1 0 1 490 2 6 150 3 7 180 2 8 210 3 ldiff does the first half of what rle does. B

Re: [R] More simple implementation is slow.

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 13:16 , wl2776 wrote: > > $sample.interval > [1] 0.02 > > $sampling.time > [1] 0.02 > > Apparently, it is about twise faster. Too fast to measure, I'd say. Try system.time, and/or multiple replications. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Busi

Re: [R] Applying a function to a column of a data frame

2012-06-09 Thread R. Michael Weylandt
No worries -- it's an important question and it introduces you to one of the most important R idioms. [And you get bonus points for having a well formed question!] You're probably looking for something like this: apply(testframe, 1, function(x) testfun(x[2])) Which goes row-by-row and substitute

[R] Applying a function to a column of a data frame

2012-06-09 Thread Onur Uncu
Apologees the novice question. Currently climbing up the learning curve of R. Suppose I have the following function and the data.frame: testfun<-function(x=1,y=2) x+y testframe=data.frame(col1=c(1,2),col2=c(3,4)) When evaluating testfun, I want to use the default value for y (which is 2) and fo

Re: [R] Reshaping columns

2012-06-09 Thread R. Michael Weylandt
Perhaps something like this: x <- c("11", "001100", "001001") # Test data strsplit(x,"") # See what strsplit does do.call(rbind, strsplit(x,"")) # Now combine the list elements nicely. Incidentally, your question was grossly malformed, involving both incomplete data and that in a non-reprod

Re: [R] Inf and NA

2012-06-09 Thread R. Michael Weylandt
Take a look at this: x <- matrix(1:9, 3) x[2,2] <- Inf x[3,1] <- NA rowMeans(x * is.finite(x), na.rm = TRUE) I at first thought you could simply use x[is.finite(x)] but that looses the matrix-ness of it so instead, we use the fact that 0 * Inf = NaN which gets killed by na.rm = TRUE. Also see my

Re: [R] Fwd: How to best analyze dataset with zero-inflated loglinear dependent variable?

2012-06-09 Thread Mark Difford
On Jun 08, 2012 at 5:37pm Heidi Bertels wrote [fwd: Iuri Gavronski]: > The dependent variable is "problematic" because of its distribution. > It is zero-inflated (many projects did not receive funding), and for > those projects that did receive funding, the distribution is > loglinear. I believ

Re: [R] More simple implementation is slow.

2012-06-09 Thread wl2776
Sorry, here are the profiles: summaryRprof("get_tau") $by.self self.time self.pct total.time total.pct "cbind" 0.02 50 0.04 100 "unlist" 0.02 50 0.0250 $by.total total.time total.pct self.time self.pct "cbind" 0.04

Re: [R] More simple implementation is slow.

2012-06-09 Thread wl2776
I've created another get_tau implementation, using sapply and apply. http://pastebin.com/3FaHAL1i However, the second variant, with expand.grid still appeals me most. I don't undestand, why it is so slow. -- View this message in context: http://r.789695.n4.nabble.com/More-simple-implementation

[R] Reshaping columns

2012-06-09 Thread efulas
Dear all, I have a data frame with 2 columns and 102500 rows. The data looks like below V1V2 809811... 9099001100... 0023110011... 654511... . . . . . . . . . . I want to split the colu

[R] Inf and NA

2012-06-09 Thread Trying To learn again
Hi all, I have a csv matrix "KT.csv" and it has Inf and NA I want to calculate the mean of each row so I use rowMeans(KT,na.rm = TRUE) but with this Inf cannot be omminted. I´m trying to use before running rowMeans(KT,na.rm = TRUE) KT<-range(KT,finite=TRUE) but it doesn´t works... Do you kno

Re: [R] ggplot incorrect legend

2012-06-09 Thread John Kane
library(ggplot2) p <- ggplot(data=tempTable, aes(x=Bands8, y=AvailableMWNewFormat, fill=as.factor(FuelTypeNum))) + geom_bar(position="stack", stat="identity")+ coord_flip() + scale_fill_discrete("test") + scale_fill_manual("FuelTypeNum",values= c("1" = "blue", "2" = "red"

Re: [R] Storing datasets

2012-06-09 Thread R. Michael Weylandt
Take a look at ?replicate. Michael On Jun 9, 2012, at 5:16 AM, Rody wrote: > Hi everyone > > I need to make a work for school in R and one of my questions is to create > 225 datasets of 100 observations and they need to be t_225 distributed. So, > I know how to make one dataset (rt(100,df=225

Re: [R] Legend: Custom distance between lines and text

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 13:04 , Sebastian Schubert wrote: > Hi, > > I guess I overlook the corresponding part in the manual but how can I > modify the distance between the text and the line in a legend? > > Thank you for any hints! You mean like this? plot(0) legend(1, .5, legend=c("foo","bar"), l

Re: [R] More simple implementation is slow.

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 11:08 , wl2776 wrote: > Hi all. > I'm developing a function, which must return a square matrix. > > Here is the code: > http://pastebin.com/THzEW9N7 > > These functions implement an analog of two embedded for cycles. > > The first variant creates the resulting matrix by colu

[R] Legend: Custom distance between lines and text

2012-06-09 Thread Sebastian Schubert
Hi, I guess I overlook the corresponding part in the manual but how can I modify the distance between the text and the line in a legend? Thank you for any hints! Sebastian signature.asc Description: OpenPGP digital signature __ R-help@r-project.org

Re: [R] Error when attempting to install tkrplot

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 11:36 , John wrote: > The capabilities(tcltk) query yields TRUE. > > Searching the /usr tree does not locate any file "tk.h." So the fix is to install it. Depending on your unstated Linux variant, that'll be tk-dev, tk-devel or so and install via yum, apt-get, or ... --

[R] Re : Error when attempting to install tkrplot

2012-06-09 Thread Pascal Oettli
Hello, It is not an R issue but a Linux issue. Please check you have tcl/tk installed on your system. Best Regards, Pascal - Mail original - De : John À : r-help@r-project.org Cc : Envoyé le : Samedi 9 juin 2012 18h36 Objet : [R] Error when attempting to install tkrplot I am getting

[R] Storing datasets

2012-06-09 Thread Rody
Hi everyone I need to make a work for school in R and one of my questions is to create 225 datasets of 100 observations and they need to be t_225 distributed. So, I know how to make one dataset (rt(100,df=225)), but how can I store those 225 in one vector, array,.. ? -- View this message in conte

[R] Error when attempting to install tkrplot

2012-06-09 Thread John
I am getting following error when attempting to install the tkrplot package. ... gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/tcl8.5 -I/usr/include/tcl8.5 -fpic -O3 -pipe -g -c tcltkimg.c -o tcltkimg.o tcltkimg.c:2:16: fatal error: tk.h: No such file or directory compilat

[R] More simple implementation is slow.

2012-06-09 Thread wl2776
Hi all. I'm developing a function, which must return a square matrix. Here is the code: http://pastebin.com/THzEW9N7 These functions implement an analog of two embedded for cycles. The first variant creates the resulting matrix by columns, cbind()-ing them one by one. The second variant creates