Re: [R] R functions

2011-09-15 Thread B77S
Suji, # Here is your data ("test"). test <- structure(list(Chr = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "chr2", class = "factor"), start = c(9896633L, 9896639L, 14314039L, 14404467L, 14421718L, 16031710L, 16036178L, 16048665L, 37491676L, 37702947L), end = c(9896683L, 989

Re: [R] Colour code y-axis labels on a dot plot

2011-09-15 Thread markm0705
Dear Carlos Attached is attempt at getting your scales suggestion to work (which at the moment does not) - I'm hoping you have the time to assist again (data file correctly attached this time). Thanks in advance Mark M On Thu, Sep 15, 2011 at 11:30 PM, Carlos Ortega [via R] < ml-node+s78

[R] Extracting BLUPs!

2011-09-15 Thread Kishor K. Bhattarai
Dear R experts, Suppose I have an data frame likes this: SampleID grain huskfill 1 KB001 0.076350637 0.28662970 1.45790428 2 KB001 0.118940999 0.22795690 2.94869785 3 KB001 0.150254385 0.56241033 1.09677303 4 KB002 0.188315675 0.21455241 0.96

Re: [R] Questions on 'lme' function, urgent!

2011-09-15 Thread karena
Ok. Thank you. karena On Thu, Sep 15, 2011 at 5:33 PM, Bert Gunter [via R] < ml-node+s789695n3816961...@n4.nabble.com> wrote: > You should post this to the r-sig-mixed-models list, not here. > > -- Bert > > On Thu, Sep 15, 2011 at 1:42 PM, karena <[hidden > email]

Re: [R] In optim() function, second parameter in par() missing

2011-09-15 Thread colstat
Hi, David I happened to see this http://www.unc.edu/~monogan/computing/r/MLE_in_R.pdf And they wrote optim(c(0,1),normal.lik1,y=y,method="BFGS") But it doesn't actually work, like you mentioned, it only takes 2 parameters, is that the reason why. R gives this error > optim(par=parameters, normal.

Re: [R] problem with predict.gam in package gam

2011-09-15 Thread Drew Tyre
Thank you! It also works on a second computer here with the details below, so something must be messed up on the other machine. > sessionInfo() R version 2.13.1 (2011-07-08) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.

Re: [R] xyplot remove ticks from top and right

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 10:44 PM, Alex Olssen wrote: Dear R-help, I am drawing a graph using xyplot. The axis labels only appear on the left and bottom axes - I used the option xyplot(scale = list(alternating = 1)) Just read the help page: ?xyplot There is a tck argument to scales that you

[R] xyplot remove ticks from top and right

2011-09-15 Thread Alex Olssen
Dear R-help, I am drawing a graph using xyplot. The axis labels only appear on the left and bottom axes - I used the option xyplot(scale = list(alternating = 1)) However while the labels no longer appear on the top and right border of the graph the ticks do! Any help would be greatly appreciate

[R] demo creating

2011-09-15 Thread John Clark
R experts: I want to prepare a demo (that will play sequentially in clicks) for a presentation tutorial...Can somebody help me how can I write a demo, suppose the following are steps in the demo.. #start set.seed(1345) x1 <- sample(letters[1:10], 5) x1 sort(x1) x <- sample(1:10, 5) y <- sample(c

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-15 Thread rmailbox
What am I missing about your inquiry: It seems like x[ , colName ] should work: testDFcols <- function(x = data.df, select=c(1:ncol(x)), bar=TRUE) { if(bar) cat("##\n"); for (column in select) { colName <-names(x)[column] cat("Column Name(", c

Re: [R] Returning the name of an object passed directly or from a list by lapply

2011-09-15 Thread William Dunlap
Is th following the sort of thing you are looking for? f <- function (...) { unevaluatedArgs <- substitute(...()) evaluatedArgs <- list(...) stopifnot(length(unevaluatedArgs) == length(evaluatedArgs)) tags <- vapply(unevaluatedArgs, FUN=function(x) deparse(x)[1], FUN.VALUE=

[R] Referring to an object by a variable containing its name: 6 failures

2011-09-15 Thread andrewH
Dear Folks-- I'm trying to make a function that takes the columns I select from a data frame and then uses a for loop to print some information about each one, starting with the column name. I succeed in returning the column name, but nothing else I have tried using the variable colName, containin

Re: [R] Returning the name of an object passed directly or from a list by lapply

2011-09-15 Thread andrewH
Thanks Bill! You are correct. I did not understand what was inmy list. I posted a simplified example in the hope of focusing on the essentials, but I see I have edited out the motivation. When my programs go awry, and sometimes when they don't, I find I need to understand what is in some variabl

Re: [R] plot(m, which = 1), where m is a lm linear model. What is 'which' doing?

2011-09-15 Thread Weidong Gu
Remember R is object-oriented. Your m is lm object, so check ?plot.lm Weidong Gu On Thu, Sep 15, 2011 at 8:14 PM, Idris Raja wrote: > Sample code from *R CookBook* (awesome book btw) *11.12: Finding the Best > Power Transformation (Box-Cox) Procedure* > > require(MASS) > x <- 10:100 > eps <- rn

[R] plot(m, which = 1), where m is a lm linear model. What is 'which' doing?

2011-09-15 Thread Idris Raja
Sample code from *R CookBook* (awesome book btw) *11.12: Finding the Best Power Transformation (Box-Cox) Procedure* require(MASS) x <- 10:100 eps <- rnorm(length(x), sd = 5) y <- (x + eps)^(-1 / 1.5) m <- lm(y ~ x) # * What does the *which* in this line do???

Re: [R] R functions

2011-09-15 Thread B77S
If your data is named 'test_file' then use dput(test_file) You can copy and paste the results here so people can more easily try and help you. see ?dput sujitha wrote: > > Hi group, > I am trying to right a code to do the following > This is how the test file looks like: > Chr start end sa

Re: [R] cumVar and cumSkew

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 5:57 PM, D_Tomas wrote: Hi there, I need to do the same thing as cumsum but with the variance and skewness. I have tried to do a loop for like this: var.value <- vector(mode = "numeric", length = length(daily)) for (i in (1:length(daily))) { var.va

Re: [R] cumVar and cumSkew

2011-09-15 Thread Albyn Jones
Wow, this takes me back a ways :-) As I recall, BMDP used updating algorithms to compute sample means, variances, and covariances in one pass through the dataset. You need the updating algorithm for means: \bar{X}_{n} = \frac{n-1}{n}\bar{X}_{n-1}+\frac{X_n}{n} You can work out the algorithm

Re: [R] merging nexus sequence files

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 6:00 PM, nikki22 wrote: Hi, newbie here, I was wondering if anyone can out, I have checked through the help archives but cannot find my answer. I have three nexus files mostly with the same taxa but some are different. I want to concatenate the DNA sequences from thes

Re: [R] Questions on 'lme' function, urgent!

2011-09-15 Thread Bert Gunter
You should post this to the r-sig-mixed-models list, not here. -- Bert On Thu, Sep 15, 2011 at 1:42 PM, karena wrote: > Hi Dear all, > > I have some gene expression data samples from different tissue types > --- > - 120 samples from blood (B) > - 20

[R] cumVar and cumSkew

2011-09-15 Thread D_Tomas
Hi there, I need to do the same thing as cumsum but with the variance and skewness. I have tried to do a loop for like this: var.value <- vector(mode = "numeric", length = length(daily)) for (i in (1:length(daily))) { var.value[i] <- var(daily[1:i]) } But beca

[R] merging nexus sequence files

2011-09-15 Thread nikki22
Hi, newbie here, I was wondering if anyone can out, I have checked through the help archives but cannot find my answer. I have three nexus files mostly with the same taxa but some are different. I want to concatenate the DNA sequences from these three files into one large nexus file but I cannot

Re: [R] question about glm vs. loglin()

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 4:33 PM, Yana Kane-Esrig wrote: Dear R gurus, I am looking for a way to fit a predictive model for a contingency table which has counts. I found that glm( family=poisson) is very good for figuring out which of several alternative models I should select. But once I sel

[R] Questions on 'lme' function, urgent!

2011-09-15 Thread karena
Hi Dear all, I have some gene expression data samples from different tissue types --- - 120 samples from blood (B) - 20 samples from Liver (L) - 15 samples from Kidney (K) - 6 samples from heart (H) --- All the

Re: [R] Returning the name of an object passed directly or from a list by lapply

2011-09-15 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of andrewH > Sent: Thursday, September 15, 2011 2:11 PM > To: r-help@r-project.org > Subject: [R] Returning the name of an object passed directly or from a list > by lapply > > Dea

Re: [R] Problems with aggregate() function in stats package

2011-09-15 Thread Marc Schwartz
On Sep 15, 2011, at 4:07 PM, Jon Zadra wrote: > Hi, > > I'm having some problems with the aggregate() function in the {stats} > package, and the documentation doesn't address them. > > 1) Why would the first line work, but the second not? According to the help > file, it accepts a "data=" argu

Re: [R] R functions

2011-09-15 Thread B77S
You'll never figure it out if you don't "play around" with your data. Assuming you have been able to import the data, a good place to start is to look at what tools you have available.Check out this: http://cran.r-project.org/doc/contrib/Short-refcard.pdf check out things like ?which ?max ?

[R] installation of BiodiversityR package

2011-09-15 Thread SG
I have installed R on windows 7 machine. In the install packages I can't find BiodiversityR package. I was wondering if I can get some help with the installation process. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/installation-of-BiodiversityR-package-tp3816807p381680

[R] Problems with aggregate() function in stats package

2011-09-15 Thread Jon Zadra
Hi, I'm having some problems with the aggregate() function in the {stats} package, and the documentation doesn't address them. 1) Why would the first line work, but the second not? According to the help file, it accepts a "data=" argument. with(tsrc, aggregate(x=DistRatio, by=list(Conditi

[R] question about glm vs. loglin()

2011-09-15 Thread Yana Kane-Esrig
Dear R gurus, I am looking for a way to fit a predictive model for a contingency table which has counts. I found that glm( family=poisson) is very good for figuring out which of several alternative models I should select. But once I select a model it is hard to present and interpret it, especia

[R] R functions

2011-09-15 Thread sujitha
Hi group, I am trying to right a code to do the following This is how the test file looks like: Chr start end sample1 sample2 chr2 9896633 9896683 0 0 chr2 9896639 9896690 0 0 chr2 14314039 14314098 0 -0.35 chr2 14404467 14404502 0 -0.35 chr2 14421718 14421777 -0.43 -0.35 chr2 16031710 16031769 -0.

[R] Lattice xyplot log scale labels help!

2011-09-15 Thread Cram Rigby
I have a problem with lattice log scales that I could use some help with. I'm trying to print log y-axis scales without exponents in the labels. A similar thread with Deepayan' recommendation is here: http://tolstoy.newcastle.edu.au/R/e11/help/10/09/9865.html. For example, this code using xyplot

Re: [R] installation of BiodiversityR package

2011-09-15 Thread B77S
My guess is that anyone willing to help will want more information. What version of R do you have(?), for example. BiodiversityR Depends on R version ≥ 2.13.1, and vegan ≥ 1.17-12 SG wrote: > > I have installed R on windows 7 machine. > In the install packages I can't find BiodiversityR pac

[R] Returning the name of an object passed directly or from a list by lapply

2011-09-15 Thread andrewH
Dear folks: Let’s suppose I want a function to print return the name of the object passed to it. > myname <- function(object) {out<-deparse(substitute(object)); out} This works fine on a single object: > O1 <-c(1:4) > myname(O1) [1] "O1" However it does not work if you use lapply to pass it th

Re: [R] legend with cofor-filled symbol

2011-09-15 Thread Duke
On 9/15/11 4:40 PM, Duke wrote: Hi folks, Please let me know what I am doing wrong. I want to have a legend with symbols that are filled with same color as the drawn line, but I failed to do that: plot(1:100, 1:100, pch=21, bg="red") legend("bottomright", "test", bty='n', pch=21, bg="red", c

Re: [R] Where to put tryCatch or similar in a very big for loop

2011-09-15 Thread Ken
What type of singularity exactly, if you're working with counts is it a special case? If using a Monte Carlo generation scheme, there are various workarounds such as while(sum(vec)!=0) {sample} for example. More info on the error circumstances would help. Good luck! Ken Hutchison On Sep

[R] legend with cofor-filled symbol

2011-09-15 Thread Duke
Hi folks, Please let me know what I am doing wrong. I want to have a legend with symbols that are filled with same color as the drawn line, but I failed to do that: plot(1:100, 1:100, pch=21, bg="red") legend("bottomright", "test", bty='n', pch=21, bg="red", col="red") It looks to me that th

[R] RGoogleMpas error

2011-09-15 Thread Gabriel Ibarra
I am trying to use RgoogleMaps but when I try to run the script example from "RgoogleMaps-intro.pdf -page 3" (see below) I get the following error "Error en plot.xy(xy.coords(x, y), type = type, ...) " I have tried to solve it but I am going crazy with this, because sometime in the past I made i

Re: [R] Tobit Fixed Effects

2011-09-15 Thread Felipe Nunes
Hi Arne, I did both ways (pooled and pdata.frame), but in none I got a result. The coefficients are estimated, but not the std. errors. I'm using BFGS method, but I didn't increase the number of iterations yet. Let me try! Best, *Felipe Nunes* CAPES/Fulbright Fellow PhD Student Political Science

Re: [R] Problem looping a function to create/add to new dataframe

2011-09-15 Thread Michael L. Treglia
Thank you all- with your suggestions I was able to get this simulation to run- sorry, next time I'll post some reproduceable code- it had been a while since I posted, so I forgot about that. Best, Mike On 9/15/2011 1:40 PM, David Winsemius wrote: On Sep 15, 2011, at 1:50 PM, Mike Treglia wrot

Re: [R] How to compute the power of a wilcoxon test?

2011-09-15 Thread peter dalgaard
On Sep 15, 2011, at 17:15 , tn85 wrote: > Thank you, Peter. They are empirical quantities, that's why I felt confused > as being requested to give the power of my test. Could you please clarify the > reason why power calculations are not fit for empirical quantities? So that I > can defend my

Re: [R] how to identify the value in a scatterplot?

2011-09-15 Thread Greg Snow
?identify -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of bby2...@columbia.edu > Sent: Thursday, September 15

[R] how to identify the value in a scatterplot?

2011-09-15 Thread bby2103
I'm plotting x and y and there are a couple of outliers. I want to show the value of z for these couple of outliers. Is there an easy way to do this? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] odfWeave: Combining multiple output statements in a function

2011-09-15 Thread Jan van der Laan
Max, Thank you for your answer. I have had another look at the examples (I already had before mailing the list), but could find the example you mention. Could you perhaps tell me which example I should have a look at? Regards, Jan On 09/15/2011 04:47 PM, Max Kuhn wrote: There are examples

Re: [R] Tobit Fixed Effects

2011-09-15 Thread Arne Henningsen
On 15 September 2011 20:09, Felipe Nunes wrote: > I did both ways (pooled and pdata.frame), but in none I got a result. The > coefficients are estimated, but not the std. errors. I'm using BFGS method, > but I didn't increase the number of iterations yet. Let me try! ... and I highly recommend to

Re: [R] Problem looping a function to create/add to new dataframe

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 1:50 PM, Mike Treglia wrote: Dear List Members, I have created a function to run a simulation based on a given set of values within a vector, such that I run the function like this: new.data<-sapply(vector, function) In which I run 'function' on every value within a ve

Re: [R] how to install a locally built package

2011-09-15 Thread Bond, Stephen
I got it working by typing a string in getdfv.Rd after \title{ \title{ getdf %% ~~function to do ... ~~ } Strange why the skeleton would not do that given it did \name{getdfv} \alias{getdfv} Anyway, I'm happy now. Stephen Bond -Original Message- From: Uwe Ligges [mailto:lig...@stati

Re: [R] Problem looping a function to create/add to new dataframe

2011-09-15 Thread jim holtman
It would seem you want something like this: new.data <- sapply(seq(10, 100, 10), function(i) sapply(vector, yourFunc, i)) On Thu, Sep 15, 2011 at 1:50 PM, Mike Treglia wrote: > Dear List Members, > > I have created a function to run a simulation based on a given set of values > within a vector,

Re: [R] (no subject)

2011-09-15 Thread R. Michael Weylandt
What does any of this mean? You might try integrate() Michael Weylandt On Thu, Sep 15, 2011 at 1:46 PM, tarq khhh wrote: > I have Q > > how can I do integrate to BS > where BS=1/m sum{(s(t|x)^2/g(t))+(1-s(t|x)^2)/g(t)} > > lower=1, upper = 5 > Thanks >[[alternative HTML version deleted

[R] (no subject)

2011-09-15 Thread tarq khhh
I have Q   how can I do integrate to BS where BS=1/m sum{(s(t|x)^2/g(t))+(1-s(t|x)^2)/g(t)}   lower=1, upper = 5 Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

[R] Problem looping a function to create/add to new dataframe

2011-09-15 Thread Mike Treglia
Dear List Members, I have created a function to run a simulation based on a given set of values within a vector, such that I run the function like this: new.data<-sapply(vector, function) In which I run 'function' on every value within a vector that I created. The result is a matrix of 1000

Re: [R] Questons about 'igraph' package

2011-09-15 Thread karena
Thank you so much, Gabor. It works well! -- View this message in context: http://r.789695.n4.nabble.com/Questons-about-igraph-package-tp3814338p3816219.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list h

Re: [R] Unexpected behavior from which.max (or possibly max)

2011-09-15 Thread Duncan Murdoch
On 15/09/2011 10:40 AM, Jason Curole wrote: Hi all, I was recently writing a script to identify the value and id of the maximum observation in a sliding window when I ran into some unexpected behavior. I have included an example. > test<- c() > test$elev<- c(1:200) > test$i<- 1 > test$wind

Re: [R] Nonlinear regression question

2011-09-15 Thread Greg Snow
What null hypothesis are you trying to test? There is a standard null for linear models that makes sense in a large number of cases, but what the null is for non-linear regression is not obvious (and the coefficient = 0 may not even be possibly, let alone interesting). If you can state what yo

Re: [R] how to find unique pairs of variables?

2011-09-15 Thread bonnie yuan
David and Sarah, Both suggestions work beautifully. Thanks! Bonnie > CC: r-help@r-project.org > From: dwinsem...@comcast.net > To: bby2...@columbia.edu > Subject: Re: [R] how to find unique pairs of variables? > Date: Thu, 15 Sep 2011 12:41:03 -0400 > > > On Sep 15, 2011, at 12:27 PM, bby2...@c

Re: [R] Color barplots with a conditional?

2011-09-15 Thread Carlos Ortega
Hello, There are some specific examples included in the help of barplot() that answer your question. Regards, Carlos Ortega www.qualityexcellence.es On Wed, Sep 14, 2011 at 10:14 PM, Allie818 wrote: > I've made a barplot that has several bars. I'd like the bars to be colored > according to the

Re: [R] how to find unique pairs of variables?

2011-09-15 Thread Bert Gunter
I should try reading the Help page! Please ignore my prior "advice" -- except for the party about FAQ 7.31, which may still apply, of course. -- Bert On Thu, Sep 15, 2011 at 9:34 AM, Sarah Goslee wrote: > Hi Bonnie, > > ?unique probably would have done the trick for you. But here's an > exampl

Re: [R] how to find unique pairs of variables?

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 12:27 PM, bby2...@columbia.edu wrote: I have two variables, both numerical. I would like to find the unique values of the pairs, in other words, unique coordinates if I were to plot them. I also need to know how many pairs there are, but I guess I can use length() if

Re: [R] how to find unique pairs of variables?

2011-09-15 Thread Bert Gunter
Bonnie: 1. As usual, see FAQ 7.31. unique() may not mean what you think it means for finite precision numbers: > unique(c(1/3, sqrt(2)*1/3/sqrt(2))) [1] 0.333 0.333 But modulo that: unique(paste(v1,v2)) will give you what you're looking for I think. -- Bert On Thu, Sep 15, 2011 at 9:27

Re: [R] how to find unique pairs of variables?

2011-09-15 Thread Sarah Goslee
Hi Bonnie, ?unique probably would have done the trick for you. But here's an example: > z <- data.frame(x = rep(1:5, each=2), y = rep(1:2, each=5)) > z x y 1 1 1 2 1 1 3 2 1 4 2 1 5 3 1 6 3 2 7 4 2 8 4 2 9 5 2 10 5 2 > unique(z) x y 1 1 1 3 2 1 5 3 1 6 3 2 7 4 2 9 5 2 > nrow(unique(z

[R] how to find unique pairs of variables?

2011-09-15 Thread bby2103
I have two variables, both numerical. I would like to find the unique values of the pairs, in other words, unique coordinates if I were to plot them. I also need to know how many pairs there are, but I guess I can use length() if I can somehow isolate the unique pairs first? Thanks a lot!

Re: [R] how to install a locally built package

2011-09-15 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Bond, Stephen > Sent: Thursday, September 15, 2011 8:48 AM > To: Uwe Ligges > Cc: r-help@r-project.org > Subject: Re: [R] how to install a locally built package > > Uwe, > > Tha

Re: [R] import csv file into R, strange problem

2011-09-15 Thread bby2103
Thanks for all the input. You were right. It was not csv file in the correct format. As it turned out, it's not a R problem, more a MAC problem. For some reason, my MAC doesn't correctly download csv file from internet, which caused all the subsequent problems. I will have to take it to a m

Re: [R] how to install a locally built package

2011-09-15 Thread Uwe Ligges
On 15.09.2011 17:47, Bond, Stephen wrote: Uwe, That gave me the same error like CMD install install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL, type="source") install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL, type="source") Loading required package: stats Loading required pack

Re: [R] Model Selection with Phylogenetic Independent Contrasts

2011-09-15 Thread Ben Bolker
rjswift gmail.com> writes: > > I'm trying to select a model under PCA using independent contrasts. Since > PICs need to be forced through the origin I've been using lmorigin for the > original regression, but it doesn't appear that stepAIC recognizes it. I > keep receiving an error message - "Er

Re: [R] Unexpected behavior from which.max (or possibly max)

2011-09-15 Thread Mario Valle
If I enclose x$i+x$window in parentheses it works: check.max<- function(x){obs.max<- which.max(x$elev[x$i:(x$i+x$window)]); obs.max} x$elev[x$i:x$i+x$window] means: x$elev[(x$i:x$i)+x$window] Simple. mario check.max(test) [1] 11 What am I missing? Here is sessionInfo (I

[R] changing "label" in ggplot

2011-09-15 Thread Thomthom
Hi everyone, I'm trying to create a scatterplot (with ggplot2) with different groups and a faceting (see code below... much clearer I think) But when I want to change the color label to something else using the scale_colour_manual function (based on http://had.co.nz/ggplot2/scale_manual.html), it

[R] Unexpected behavior from which.max (or possibly max)

2011-09-15 Thread Jason Curole
Hi all, I was recently writing a script to identify the value and id of the maximum observation in a sliding window when I ran into some unexpected behavior. I have included an example. > test <- c() > test$elev <- c(1:200) > test$i <- 1 > test$window <- 10 The following works for me: > check.

Re: [R] how to install a locally built package

2011-09-15 Thread Bond, Stephen
Uwe, That gave me the same error like CMD install > install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL, type="source") install.packages("C:/Temp/mypack_1.0.tar.gz", repos=NULL, type="source") Loading required package: stats Loading required package: utils Loading required package: graphics

Re: [R] how to install a locally built package

2011-09-15 Thread Uwe Ligges
On 15.09.2011 17:32, Bond, Stephen wrote: Hello useRs, I am trying to put my funcs in a package to avoid clutter in my workspace as the funcs are now in .Rprofile. All plain R code no compilations. Using win XP with a full cygwin install and R2.12 I first did package.skeleton("mypack",list=

Re: [R] Where to put tryCatch or similar in a very big for loop

2011-09-15 Thread Bonnett, Laura
Hi Steve, Thanks for your response. The slight issue is that I need to use a different starting seed for each simulation. If I use 'lapply' then I end up using the same seed each time. (By contrast, I need to be able to specify which starting seed I am using). Thanks, Laura -Original M

[R] how to install a locally built package

2011-09-15 Thread Bond, Stephen
Hello useRs, I am trying to put my funcs in a package to avoid clutter in my workspace as the funcs are now in .Rprofile. All plain R code no compilations. Using win XP with a full cygwin install and R2.12 I first did package.skeleton("mypack",list="getdfv", namespace=T) # just a single func w

Re: [R] Colour code y-axis labels on a dot plot

2011-09-15 Thread Carlos Ortega
Hi, You can use scales() and parametrize it with a list where you can define colors, fonts, etc. I could not test it on your code because variable "Commodity" is not present in the dataset you provided. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 15, 2011 at 11:03 AM, markm0705

Re: [R] x %>% y as an alternative to which( x > y)

2011-09-15 Thread Greg Snow
One additional thing to note is that %>% will have different precedence than > (something that was pointed out to me based on %<% that is in the TeachingDemos package). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Or

Re: [R] Where to put tryCatch or similar in a very big for loop

2011-09-15 Thread Steve Lianoglou
Hi Laura, On Thu, Sep 15, 2011 at 10:53 AM, Bonnett, Laura wrote: > Dear all, > > I am running a simulation study to test variable imputation methods for Cox > models using R 2.9.0 and Windows XP.  The code I have written (which is > rather long) works (if I set nsim = 9) with the following sta

Re: [R] How to compute the power of a wilcoxon test?

2011-09-15 Thread tn85
Thank you, Peter. They are empirical quantities, that's why I felt confused as being requested to give the power of my test. Could you please clarify the reason why power calculations are not fit for empirical quantities? So that I can defend my test for such request. BTW, the correlation of th

Re: [R] How to compute the power of a wilcoxon test?

2011-09-15 Thread peter dalgaard
On Sep 15, 2011, at 15:47 , tn85 wrote: > Hello All, > > I posted a similar question before, but the direction was driven to whether > my case is suitable for a wilcoxon test. After research about the > appropriateness, I am pretty sure that a wilcoxon test is the right tool for > my case. But h

[R] Where to put tryCatch or similar in a very big for loop

2011-09-15 Thread Bonnett, Laura
Dear all, I am running a simulation study to test variable imputation methods for Cox models using R 2.9.0 and Windows XP. The code I have written (which is rather long) works (if I set nsim = 9) with the following starting values. >bootrs(nsim=9,lendevdat=1500,lenvaldat=855,ac1=-0.19122,bc1=-

Re: [R] odfWeave: Combining multiple output statements in a function

2011-09-15 Thread Max Kuhn
There are examples in the package directory that explain this. On Thu, Sep 15, 2011 at 8:16 AM, Jan van der Laan wrote: > > What is the correct way to combine multiple calls to odfCat, odfItemize, > odfTable etc. inside a function? > > As an example lets say I have a function that needs to write

Re: [R] problem with predict.gam in package gam

2011-09-15 Thread Gavin Simpson
On Wed, 2011-09-14 at 18:06 -0500, Drew Tyre wrote: > I am trying to reproduce plots in Chapter 3 of Zuur et al Mixed > Effects models and extensions in Ecology. For pedagogical reasons, > they make a series of plots with gam(...) in package gam. I encounter > errors that trace back to the predict.

Re: [R] difftime on vector

2011-09-15 Thread jim holtman
You need to supply two vectors: > x <- seq(Sys.time(), by = '10 min', length = 10) > x [1] "2011-09-15 09:58:30 EDT" "2011-09-15 10:08:30 EDT" "2011-09-15 10:18:30 EDT" [4] "2011-09-15 10:28:30 EDT" "2011-09-15 10:38:30 EDT" "2011-09-15 10:48:30 EDT" [7] "2011-09-15 10:58:30 EDT" "2011-09-15 11

Re: [R] S4 vs Reference Classes

2011-09-15 Thread Steve Lianoglou
Hi Joseph (and Martin), Don't mean to beat a dead horse, but I wanted to add one last comment to this thread in case someone stumbles upon this via google/gmane (or you) and gives it a shot. I neglected to mention a very important step that you'd have to do to in order to avoid shooting yourself

[R] How to compute the power of a wilcoxon test?

2011-09-15 Thread tn85
Hello All, I posted a similar question before, but the direction was driven to whether my case is suitable for a wilcoxon test. After research about the appropriateness, I am pretty sure that a wilcoxon test is the right tool for my case. But how to compute the power of the test is still an unansw

Re: [R] p-value for non linear model

2011-09-15 Thread Bert Gunter
Tatiana: It sounds like you are in way over your head statistically. This is not a statistics tutorial site (though sometimes good folks do help witjh this). I suggest you try http://stats.stackexchange.com/ . Better yet, work with your local statistician. Cheers, Bert On Thu, Sep 15, 2011 at 6

Re: [R] Force regression line to a 1:1 relationship

2011-09-15 Thread Bert Gunter
This sounds like you need a mixed effects model (e.g. lme or lmer instead of lm) instead of the possibly spurious adhocery that you describe. I suggest you post your message on the SIG-mixed-effects list and/or get help from a local statistician Cheers, Bert On Thu, Sep 15, 2011 at 1:49 AM, RCull

[R] p-value for non linear model

2011-09-15 Thread Tatiana Donnay
Hello, I want to understand how to tell if a model is significant. For example I have vectX1 and vectY1. I seek first what model is best suited for my vectors and then I want to know if my result is significant. I'am doing like this: model1 <- lm(vectY1 ~ vectX1, data= d), model2 <- nls(vectY1

[R] Nonlinear regression question

2011-09-15 Thread Tatiana Donnay
Hello, If I understand good, I can't have p-value for the nls model. I have 2 vectors. And I'am doing model <- nls(crf ~a*(1-exp(-x/b)) + c, data= d, start = list(a=1, b=3, c=0)) and I want to know If my result is significat, if I can't have p-value, how can I know it? Thank y

[R] difftime on vector

2011-09-15 Thread bradford
How can I apply difftime to a vector of sorted dates? I can do this just fine with diff, but difftime doesn't seem to take in a vector. > diff(r$BOOKING_DATE) Works. Great! > difftime(r$MY_DATE, units="days") Error in as.POSIXct(time2) : argument "time2" is missing, with no default Thanks, Bra

Re: [R] help with hclust

2011-09-15 Thread Marcelino de la Cruz
>From: Madeleine Seeland in.tum.de> >Subject: help with hclust >Date: 2011-09-14 08:14:48 GMT >Hello, > >I have two questions regarding hclust: > >1) First I would like to cut a hclust tree at a specific height and receive the cluster (di) similarity at this >height. With an example:

Re: [R] Can 'mosaic' be used with a continuous variable?

2011-09-15 Thread Michael Friendly
Hi Mauricio On 9/14/2011 2:10 PM, Mauricio Cornejo wrote: Thanks Z. Let me clarify my problem a bit further ... as I don't think I could use cut() or spine() to solve it. I have a data frame with three columns (A, B, Value). 'A' and 'B' are categorical and 'Value' is continuous and non-nega

[R] Allocation of data points to groups based on membership probabilities

2011-09-15 Thread Michael Haenlein
Dear all, I have a matrix that provides, for a series of data points, the probability that each of these points belongs to a certain group. Take the following example, which represents 20 data points and their group membership probability to five groups (A-E): set.seed(1) probs <- matrix(runif(10

Re: [R] MCMCglmm heteroscedasticity dependent on predictor

2011-09-15 Thread Ben Bolker
Atle Torvik Kristiansen gmail.com> writes: > I have a dataset where the residual variance decreases with on one of > the predictors (population size). > > Currently, the full model looks like this: > > prior<-list(R=list(V=1e-16, nu=-2),G1=list(V=diag(2), nu=2)) > > m<-MCMCglmm(response~poly(p

Re: [R] Nonlinear Regression

2011-09-15 Thread John C Nash
optim() optimx package minpackLM package and several others JN On 09/15/2011 06:00 AM, r-help-requ...@r-project.org wrote: > Message: 77 > Date: Wed, 14 Sep 2011 20:44:16 +0100 > From: Liam Brown > To: r-help@r-project.org > Subject: [R] Nonlinear Regression > Message-ID: > > Content-Typ

[R] odfWeave: Combining multiple output statements in a function

2011-09-15 Thread Jan van der Laan
What is the correct way to combine multiple calls to odfCat, odfItemize, odfTable etc. inside a function? As an example lets say I have a function that needs to write two paragraphs of text and a list to the resulting odf-document (the real function has much more complex logic, but I don'

Re: [R] Strange pdf() in Fedora 15

2011-09-15 Thread Marc Schwartz
On Sep 15, 2011, at 7:06 AM, Petar Milin wrote: > Hello useRs! > Recently, I migrated from Debian i386 to Fedora 15 64-bit, after a long > and happy experiences with Debian distributions (first Ubuntu, later > Debian itself). I installed R with yum install R, and then necessary > packages. Everyth

[R] Strange pdf() in Fedora 15

2011-09-15 Thread Petar Milin
Hello useRs! Recently, I migrated from Debian i386 to Fedora 15 64-bit, after a long and happy experiences with Debian distributions (first Ubuntu, later Debian itself). I installed R with yum install R, and then necessary packages. Everything seems to work fine, for now, except that exporting plot

Re: [R] linear probability model

2011-09-15 Thread Adam Copella
Many thanks! Adam 2011/9/14 Achim Zeileis > On Wed, 14 Sep 2011, Adam Copella wrote: > > Dear All, >> >> Is there any function in R for fitting linear probability model, as my >> response variable is a uniformly distributed. >> > > If it is really uniformly distributed, I think there is not muc

Re: [R] Questons about 'igraph' package

2011-09-15 Thread Gábor Csárdi
The 'name' attribute is not used for vertex labels by default. If you want to use it, you need to set it as the 'label' attribute as well, or supply them in the function call: tkplot(graph, vertex.label=V(graph)$name) Best, Gabor On Wed, Sep 14, 2011 at 7:11 PM, karena wrote: > Hi, > > I am usi

Re: [R] Hints for Data Mining

2011-09-15 Thread Abhijit Dasgupta
Please see the R Machine Learning Task View (http://cran.r-project.org/web/views/MachineLearning.html) for a starting point on decision trees. On 9/14/2011 7:11 PM, Lorenzo Isella wrote: > Dear All, > I am recycling a previous email of mine where I asked some questions > about clustering mixed

[R] MCMCglmm heteroscedasticity dependent on predictor

2011-09-15 Thread Atle Torvik Kristiansen
Hi, I have a dataset where the residual variance decreases with on one of the predictors (population size). Currently, the full model looks like this: prior<-list(R=list(V=1e-16, nu=-2),G1=list(V=diag(2), nu=2)) m<-MCMCglmm(response~poly(population size,2)*poly(other predictor,2)+time, random=~

  1   2   >