[R] diallel analysis

2013-07-14 Thread waqas shafqat
sir i could not find the plant breeding libraray in Rgui3.0.0 [[alternative HTML version deleted]] __ 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/postin

Re: [R] diallel analysis

2013-07-14 Thread Rui Barradas
Hello, Which package is it? Maybe you need to install it. And after installing it, you need to load it in the R session. You do this with the following commands. install.package(pkgname) # do this only once library(pkgname) # do this every new R session Hope this helps, Rui Barradas Em

Re: [R] diallel analysis

2013-07-14 Thread Rui Barradas
Sorry, It's the plural: install.packages(pkgname) Rui Barradas Em 14-07-2013 11:20, Rui Barradas escreveu: Hello, Which package is it? Maybe you need to install it. And after installing it, you need to load it in the R session. You do this with the following commands. install.package(pkgna

Re: [R] Set window title for plot on any OS

2013-07-14 Thread Simon Zehnder
Haha, good point! So, the correct code is: any(names(formals(getOption("device"))) == "title") { dev.new(title = "title") } Thanks for correcting my approach Rolf! Best Simon On Jul 14, 2013, at 1:02 AM, Rolf Turner wrote: > > > I think you ought to take a look at > >fortun

[R] creating dummy variables based on conditions

2013-07-14 Thread Anup Nandialath
Hello everyone, I have a dataset which includes the first three variables from the demo data below (year, id and var). I need to create the new variable ans as follows If var=1, then for each year (where var=1), i need to create a new dummy ans which takes the value of 1 for all corresponding id'

Re: [R] Test for column equality across matrices

2013-07-14 Thread Thiem Alrik
Dear William, thanks a lot. I've found another nice alternative: A <- matrix(t(expand.grid(c(1,2,3,4,5), 15, 16)), nrow = 3) B <- combn(16, 3) B.n <- B[, -which(duplicated(t(cbind(A, B - ncol(A)] Best wishes, Alrik -Ursprüngliche Nachricht- Von: arun [mailto:smartpink...@yahoo.com

[R] Matrix column flip when recycled

2013-07-14 Thread Thiem Alrik
Dear list, I have a matrix M.1 (30x2) into which I would like to paste another matrix M.2 (10x2) three times. However, the columns get flipped in every odd-numbered recycle run. How can I avoid this behavior? M.1 <- matrix(numeric(30*2), ncol = 2) M.2 <- t(combn(1:5, 2)) M.1[, 1:2] <- M.2 Many

[R] nls power law help

2013-07-14 Thread JenPool
Hi, I am trying to use a power law y=bx^a as a nls model as below, however I keep getting 'singular gradient' error. I have tried multiple different starting values but always get an error. > x2 <- > c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, > 31,32,33,3

Re: [R] creating dummy variables based on conditions

2013-07-14 Thread Rui Barradas
Hello, Your data seems to be of class 'matrix'. The following code needs it to be a data.frame. dat <- as.data.frame(your input matrix) res <- do.call(rbind, lapply(split(dat, list(dat$id, dat$year)), function(x){ x$ans <- if(any(x$var == 1)) 1 else 0 x})) rownames(res) <- N

Re: [R] nls power law help

2013-07-14 Thread Prof Brian Ripley
On 14/07/2013 14:30, JenPool wrote: Hi, I am trying to use a power law y=bx^a as a nls model as below, however I keep getting 'singular gradient' error. I have tried multiple different starting values but always get an error. That is not the model you tried to fit. b*x*exp(a) is always over-p

Re: [R] Matrix column flip when recycled

2013-07-14 Thread arun
library(plyr) M.1[,1:2]<-do.call(rbind,alply(replicate(3,M.2),3,function(x) x)) #or M.1[,1:2]<-matrix(aperm(replicate(3,M.2),c(1,3,2)),ncol=2) A.K. - Original Message - From: Thiem Alrik To: "mailman, r-help" Cc: Sent: Sunday, July 14, 2013 9:48 AM Subject: [R] Matrix column flip

Re: [R] Matrix column flip when recycled

2013-07-14 Thread Jeff Newmiller
Only vectors recycle. If you don't want the behaviour if the matrix to reflect that of the underlying vector then don't use recycling. Instead use indexing. M.1 <- M.2[rep(1:5,3),] --- Jeff NewmillerTh

Re: [R] creating dummy variables based on conditions

2013-07-14 Thread arun
Hi, You could try this: (if I understand it correctly) dat1<- read.table(text=" year    id var ans  2010  1  1  1  2010  2  0  0  2010  1  0  1 2010  1  0  1  2011  2  1  1  2011  2  0  1  2011  1  0  0 2011  1  0  0 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat1$newres<-with(dat1,ave(var,id,ye

Re: [R] simplify a dataframe

2013-07-14 Thread Arnaud Michel
Hi, Excuse me for the indistinctness Le 13/07/2013 17:18, arun a écrit : > Hi, > "when the value of Debut of lines i = value Fin of lines i-1" > That part is not clear esp. when it is looked upon with the expected output > (df2). I want to group the lines which have the same caracteristics (Matric

Re: [R] Set window title for plot on any OS

2013-07-14 Thread David Winsemius
On Jul 14, 2013, at 3:42 AM, Simon Zehnder wrote: > Haha, good point! > > So, the correct code is: > > any(names(formals(getOption("device"))) == "title") { > dev.new(title = "title") > } > This might be easier to read: "title" %in% names(formals(getOption("device")) ) -- David. > T

[R] Need help to read the data file like this

2013-07-14 Thread Houhou Li
Hi, I have several really big data files in csv format like this: the first line is the header, the second to fourth lines have info about the file and are the lines I need to skip (data in 2-4th lines are not correspoding to variable names in the hearder), from the fifth line, real data begins

Re: [R] R installation Problem

2013-07-14 Thread Uwe Ligges
On 08.07.2013 11:42, sridhar srinivasan wrote: Dear R Developers, I have two doubts related to R 1. i try to install R package 3.0 in my linux system ./configure. it gives Error as configure: error: --with-readline=yes (default) and headers/libs are not available Read the R Installation man

Re: [R] creating dummy variables based on conditions

2013-07-14 Thread Anup Nandialath
hi Arun, Thanks for this. This solution works great. Knid Regards Anup On Sun, Jul 14, 2013 at 8:07 PM, arun wrote: > Hi, > You could try this: (if I understand it correctly) > dat1<- read.table(text=" > yearid var ans > 2010 1 1 1 > 2010 2 0 0 > 2010 1 0 1 > 2010 1 0 1 >

Re: [R] Need help to read the data file like this

2013-07-14 Thread David Winsemius
On Jul 14, 2013, at 9:48 AM, Houhou Li wrote: > Hi, > > I have several really big data files in csv format like this: the first line > is the header, the second to fourth lines have info about the file and are > the lines I need to skip (data in 2-4th lines are not correspoding to > variable

Re: [R] simplify a dataframe

2013-07-14 Thread Arnaud Michel
An other remark : If I calculate df1$D<- as.numeric(as.Date(paste0(substr(df1$Debut,7,10),"-", substr(df1$Debut,4,5),"-",substr(df1$Debut,1,2 and df1$F <- as.numeric(as.Date(paste0(substr(df1$Fin,7,10),"-", substr(df1$Fin,4,5),"-",substr(df1$Fin,1,2 and if there is no interruption of time f

Re: [R] Test for column equality across matrices

2013-07-14 Thread William Dunlap
It looks like match() (and relatives like %in% and is.element) act a bit unpredictably on lists when the list elements are vectors of numbers of different types. If you match integers to integers or doubles to doubles it works as expected, but when the types don't match the results vary. I wou

Re: [R] Need help to read the data file like this

2013-07-14 Thread David Winsemius
On Jul 14, 2013, at 10:57 AM, David Winsemius wrote: > > On Jul 14, 2013, at 9:48 AM, Houhou Li wrote: > >> Hi, >> >> I have several really big data files in csv format like this: the first line >> is the header, the second to fourth lines have info about the file and are >> the lines I need

Re: [R] simplify a dataframe

2013-07-14 Thread arun
Hi, May be this helps you. df1$contrat[grep("^CDD",df1$contrat)]<- "CDD détaché ext. Cirad" df1[48,8] [1] "31/12/4712" #strange value df1[48,8]<- "31/12/2013"  #changed indx<-as.numeric(interaction(df1[,1:6],drop=TRUE)) res<-do.call(rbind,lapply(split(df1,indx),function(x) {x1<- as.Date(x$Debut

[R] Book recomendation: Repeated Measurements

2013-07-14 Thread Marcelo Laia
Dear, I need a book about repeated measurements analisys with R. In Amazon, I found this one: Models for Repeated Measurements (Oxford Statistical Science Series) J. K. Lindsey 1999 2ed. I would like a book with examples, data and R code. I work with trees (forest breeding). Could you recomend

Re: [R] Book recomendation: Repeated Measurements

2013-07-14 Thread Bert Gunter
Look before you post -- specifically at the "Books" subpage of CRAN's R homepage: http://www.r-project.org/ -- Bert On Sun, Jul 14, 2013 at 12:56 PM, Marcelo Laia wrote: > Dear, > > I need a book about repeated measurements analisys with R. > > In Amazon, I found this one: > > Models for Repeat

Re: [R] Book recomendation: Repeated Measurements

2013-07-14 Thread Marcelo Laia
Yes! I have a look there before I post! Thank you very much! 2013/7/14 Bert Gunter : > Look before you post -- specifically at the "Books" subpage of CRAN's > R homepage: > > http://www.r-project.org/ > > -- Bert > > On Sun, Jul 14, 2013 at 12:56 PM, Marcelo Laia wrote: >> Dear, >> >> I need a

Re: [R] Book recomendation: Repeated Measurements

2013-07-14 Thread Spencer Graves
On 7/14/2013 1:20 PM, Marcelo Laia wrote: Yes! I have a look there before I post! You may know that "mixed effects" is another term for "repeated measurements". Spencer Graves Thank you very much! 2013/7/14 Bert Gunter : Look before you post -- specifically at the "Books"

[R] Does R ever stop responding without a message?

2013-07-14 Thread L S
Hi, Have any of you ever encountered a situation where R stops processing an instruction but does not give a "not responding" message? The reason I ask is I am working in RStudio (Mac OS/X 10.7, 1.8 Ghz i7, 4 GB DDR3) and the instruction I entered in the command line pane is still being processed

Re: [R] Book recomendation: Repeated Measurements

2013-07-14 Thread Rolf Turner
On 15/07/13 08:57, Spencer Graves wrote: You may know that "mixed effects" is another term for "repeated measurements". I must of course preface this comment with an "I am no expert" disclaimer, but I do not believe that this assertion is correct. It would be more correct, I beli

Re: [R] Need hep for converting date data in POSIXct

2013-07-14 Thread arun
HI, Try this: Geo<- read.table(text=" long    lat.comp confianza  9.31   -42.72 3 11.66  -40.63 9 10.88  -38.60 9 10.72 -37.86 9 13.06 -39.04 9 16.02 -38.51 6 ",sep="",header=TRUE)  col1<- as.numeric(factor(Geo$confianza))  wi

Re: [R] Does R ever stop responding without a message?

2013-07-14 Thread David Winsemius
On Jul 14, 2013, at 2:40 PM, L S wrote: > Hi, > > Have any of you ever encountered a situation where R stops processing an > instruction but does not give a "not responding" message? > > The reason I ask is I am working in RStudio (Mac OS/X 10.7, 1.8 Ghz i7, 4 > GB DDR3) and the instruction I e

Re: [R] Does R ever stop responding without a message?

2013-07-14 Thread jim holtman
If you are writing a script that you know will take a long time to process, "pepper" it with "progress" reports so you know what part of the script it is in and when it is going around loop. On some of my long scripts, I will print out a message every n'th time through the loop so that I know if i

Re: [R] Book recomendation: Repeated Measurements

2013-07-14 Thread Spencer Graves
On 7/14/2013 3:05 PM, Rolf Turner wrote: On 15/07/13 08:57, Spencer Graves wrote: You may know that "mixed effects" is another term for "repeated measurements". I must of course preface this comment with an "I am no expert" disclaimer, but I do not believe that this assertion is c

Re: [R] simplify a dataframe

2013-07-14 Thread arun
HI Michel, This gives the same order as that of df2. df1$contrat[grep("^CDD",df1$contrat)]<- "CDD détaché ext. Cirad" df1[48,8]<- "31/12/2013" indx<-as.numeric(interaction(df1[,1:6],drop=TRUE)) lst1<-split(df1,indx)  lst2<-lst1[match(unique(indx),names(lst1))] res<-do.call(rbind,lapply(lst2,functio

Re: [R] Does R ever stop responding without a message?

2013-07-14 Thread L S
Thanks Jim and David for your helpful feedback. I still have not terminated RStudio (and it still has not gone to completion). A few observations I forgot to mention is that the red "stop" icon is showing in RStudio so I am unable to enter any new commands. Also there is a blinking cursor under

Re: [R] simplify a dataframe

2013-07-14 Thread Arnaud Michel
Super !!! Thank you very much Arun Michel Le 15/07/2013 03:47, arun a écrit : HI Michel, This gives the same order as that of df2. df1$contrat[grep("^CDD",df1$contrat)]<- "CDD détaché ext. Cirad" df1[48,8]<- "31/12/2013" indx<-as.numeric(interaction(df1[,1:6],drop=TRUE)) lst1<-split(df1,indx) l

[R] Replacing values of a matrix with values from corresponding rows of another matrix

2013-07-14 Thread Laura Cisneros
Hello all, I have been trying to figure out how to replace non-zero values of a matrix with non-zero values from corresponding rows from another matrix. More specifically, let say we have the following original matrix: original <- matrix(c(0,0,4,0,0,1,2,2,12,1,0,2,0,5,0,0,10,1,3,1,0,5,0,4),byrow=

[R] (no subject)

2013-07-14 Thread kiran subedi
Hi, I am a researcher in chemistry. I have to do pls-da for some of my samples. The number of variables for my sample is 4000 . The categorical variable has two classes. Some of the values are missing (cant find out). I s there any package for R (or any illustration that would be helpful) to perfor

Re: [R] Does R ever stop responding without a message?

2013-07-14 Thread David Winsemius
On Jul 14, 2013, at 8:24 PM, L S wrote: > Thanks Jim and David for your helpful feedback. I still have not terminated > RStudio (and it still has not gone to completion). A few observations I > forgot to mention is that the red "stop" icon is showing in RStudio so I am > unable to enter any

Re: [R] Replacing values of a matrix with values from corresponding rows of another matrix

2013-07-14 Thread Blaser Nello
For small matrix you could use a for-loop. for (i in 1:nrow(randomized)){ randomized[i,randomized[i,]!=0] <- sample(original[i,original[i,]!=0]) } randomized If you have a larger matrix sapply is probably faster randomized <- t(sapply(1:nrow(randomized), function(i) { randomized[i,randomized[