Re: [R] 3D matrix columns messed up

2015-10-12 Thread Jim Lemon
Hi Kristi, The first part is relatively easy: # change first line to x$time<-factor(x$time,levels=c("t1","t2","t3","t4","t10","t21")) As you have specified "site" as the second element in "x", not the third, perhaps you just want: x<-structure(list(vs = structure(c(1L, 1L, 2L, 3L, 4L, 2L, 3L,

[R] Using MASS::boxcox for a single variable gives different results than the original paper

2015-10-12 Thread Tal Galili
Hello all, Given a set of observations, I would like to find lambda for a boxcox transformation so to get a symmetric/normal result as possible. I try to use MASS::boxcox, but get different results than when using the formula from the original box-cox paper (link

[R] Percentage sign in Vegan output

2015-10-12 Thread gktahon
Hi All, I'm using the Vegan package in R to calculate some variables for my data set and to make rarefaction curves. However, I would like to give clear names to my samples and I do not succeed in this. For the package, I first read my OTU table (this is a text file with my samples listed per

[R] predictions several categories

2015-10-12 Thread AURORA GONZALEZ VIDAL
Hello everybody. I am using the caret package in order to predict something from some data. I have "hours" , "days" and "temperature" where "hours" are given in decimal form, "days" are the days of the week where each observation was colected and "temperature" is the temperature that a user of

Re: [R] Using MASS::boxcox for a single variable gives different results than the original paper

2015-10-12 Thread Tal Galili
After trying this with the function "estimateTransform" from {car}, it returns values similar to my solution rather than the one from MASS::boxcox: # Toy data set.seed(13241089) x <- rnorm(1000, 10) x2 <- x**2 # we want to transform x2 to something more normal # using

[R] Command to input a variable value in real time

2015-10-12 Thread nicholas . wray
Hi I am sure that there is a command in R which tells the prog to wait until you have input a value for a variable, but for the life of me I can't find it. Searches on the net only seem to talk about inputting datasets etc, not about real time single inputs. I'd be most grateful if anyone could

Re: [R] Command to input a variable value in real time

2015-10-12 Thread Franklin Bretschneider
Dear nicholas.wray, Re: > Hi I am sure that there is a command in R which tells the prog to wait until > you have input a value for a variable, but for the life of me I can't find it. > Searches on the net only seem to talk about inputting datasets etc, not about > real time single inputs. I'd

Re: [R] Using MASS::boxcox for a single variable gives different results than the original paper

2015-10-12 Thread peter dalgaard
Two things: A) x2 ~ zpoints(x2) is not right B) granularity: > a <- MASS::boxcox(x2 ~ 1,lambda=seq(-2,2,1e-5)) > mle(a) [1] 0.40783 -pd On 12 Oct 2015, at 11:17 , Tal Galili wrote: > Hello all, > > Given a set of observations, I would like to find lambda for a boxcox >

Re: [R] Using MASS::boxcox for a single variable gives different results than the original paper

2015-10-12 Thread Tal Galili
Peter and John - thank you both for the answers. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Command to input a variable value in real time

2015-10-12 Thread Ivan Calandra
Dear Nick, You might find the function varEntryDialog() useful: http://www.r-bloggers.com/user-input-using-tcltk-2/ HTH, Ivan -- Ivan Calandra, PhD University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89

Re: [R] Command to input a variable value in real time

2015-10-12 Thread Ivan Calandra
See this link for the function varEntryDialog() itself: http://www.r-bloggers.com/user-input-using-tcltk/ Ivan Le 12/10/15 15:57, Ivan Calandra a écrit : Dear Nick, You might find the function varEntryDialog() useful: http://www.r-bloggers.com/user-input-using-tcltk-2/ HTH, Ivan -- Ivan

Re: [R] Using MASS::boxcox for a single variable gives different results than the original paper

2015-10-12 Thread Fox, John
Dear Tal, MASS:boxcox() evaluates the pseudo-log-likelihood at a pre-specified vector of values of the transformation parameter lambda. In your example, > head(a$x) [1] -2.00 -1.959596 -1.919192 -1.878788 -1.838384 -1.797980 Which accounts, I think, for the small difference in the answer.

[R] by group

2015-10-12 Thread Val
Hi all, Assume that I have the following data set : cntry state city Gender (1=F and 2=M) 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 2 3 2 1 2 3 1 I want to calculate the number of Females and Males, total (F+M) and percentage (F/M) by country, state and city. Here is

[R] library(nlme) groupedData question‏

2015-10-12 Thread Andre Mikulec
SUMMARY --- Using package nlme, I am getting the following warning when I try to create a grouped data object using groupedData(). I believe that my logic is faulty. Warning message: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste0(labels,  :   duplicated

Re: [R] Percentage sign in Vegan output

2015-10-12 Thread David Winsemius
On Oct 12, 2015, at 2:08 AM, gktahon wrote: > Hi All, > > I'm using the Vegan package in R to calculate some variables for my data set > and to make rarefaction curves. > However, I would like to give clear names to my samples and I do not succeed > in this. > > For the package, I first read

Re: [R] writing a function that will refer to the elements of a dataframe much as is done by lm

2015-10-12 Thread Jim Lemon
Hi John, Here are a couple of ways to do this. Note that they produce slightly different results. data2<-data.frame(POSTHHMONO=c(1,2,3,4),Mo6MON=c(10,11,12,13)) doit<- function(pre,post,data) { element <- deparse(substitute(pre)) print(element) print(data[element])

Re: [R] writing a function that will refer to the elements of a dataframe much as is done by lm

2015-10-12 Thread David Winsemius
On Oct 12, 2015, at 3:11 PM, John Sorkin wrote: > I am trying to learn how to write R functions (really to program in R). I > want to write a function that will allow me to refer to the elements of a > data frame by column name, much as is done in lm. I can't seem to get the > syntax

[R] writing a function that will refer to the elements of a dataframe much as is done by lm

2015-10-12 Thread John Sorkin
I am trying to learn how to write R functions (really to program in R). I want to write a function that will allow me to refer to the elements of a data frame by column name, much as is done in lm. I can't seem to get the syntax correct. I want the function to print the elements of

[R] readaff() problem

2015-10-12 Thread Amit Sengupta via R-help
Hi,I am having a problem with the ReadAffy() in the university R programming environment. I install affyPLM and invoke library(affyPLM) in the following way. I have the cel files in the craig subdirectory. Please let me know how to resolve the problem.Amit

Re: [R] by group

2015-10-12 Thread MCGUIRE, Rhydwyn
ddply() is what you are looking for. Here is an example http://www.inside-r.org/packages/cran/plyr/docs/ddply Cheers, Rhydwyn Rhydwyn McGuire Senior Biostatistician | Health Statistics NSW Level 7, 73 Miller St, North Sydney 2060 Tel 02 9391 9781 | rm...@doh.health.nsw.gov.au

[R] Testing Restrictions on Beta (long-run coefficients), reproducible example

2015-10-12 Thread mrrox
The code given below estimates a VEC model with 4 cointegrating vectors. It is a reproducible code, so just copy and paste into your R console (or script editor). nobs = 200 e = rmvnorm(n=nobs,sigma=diag(c(.5,.5,.5,.5,.5))) e1.ar1 = arima.sim(model=list(ar=.75),nobs,innov=e[,1]) e2.ar1 =

[R] how to do away for loop using functionals?

2015-10-12 Thread Annie Hawk via R-help
HI R-experts, I am trying to speed up my calculation of the A results below and replace the for loop withsome functionals like lapply.  After manyreadings, trial and error, I still have no success.  Would anyone please give me some hints onthat?  Thank you in advance. Anne  The program