Re: [R] 2SLS / TSLS / SEM non-linear

2013-07-14 Thread Arne Henningsen
Dear HC On 30 June 2013 18:53, hck hans-christian.krumh...@uni-ulm.de wrote: Generally I would have the following equations X_i = IV3_i + IV4_i * Y_i applying for every company (i). In a first step, I am interested in estimating the relationship between X and Y: Y_i = a + b * X_i + u to

[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

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

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.

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 rolf.tur...@xtra.co.nz wrote: I think you ought to take a look at

[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

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,

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) - NULL

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

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 th...@sipo.gess.ethz.ch To: mailman, r-help r-help@r-project.org Cc: Sent: Sunday, July 14, 2013

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 Newmiller

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)

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 (Matricule,

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. Thanks for

[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

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

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 smartpink...@yahoo.com 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

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 names

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 for the

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

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 to skip

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-

[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

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 marcelol...@gmail.com wrote: Dear, I need a book about repeated measurements analisys with R. In Amazon, I found this one:

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 gunter.ber...@gene.com: 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

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 gunter.ber...@gene.com: Look before you post --

[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: SNIP You may know that mixed effects is another term for repeated measurements. SNIP 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

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))  

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 entered

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 it

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: SNIP You may know that mixed effects is another term for repeated measurements. SNIP I must of course preface this comment with an I am no expert disclaimer, but I do not believe that this assertion

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,function(x){x1-

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)