[R] Mediation using 'mediate' in R with an interaction

2014-05-10 Thread Lauren Howe
Hi everyone, I have a question about mediation when there is an interaction between 2 categorical variables, one with two levels and one with three levels. Using the ‘mediation’ package by Tingley and colleagues in R, I’m trying to conduct a bootstrapped mediation analysis for an

[R] recall variable in a loop

2014-05-10 Thread Marco Chiapello
I'd like to create several tables in which my data are stored. I did the follow: x-mydata splitted-split(x[,1],x[,2]) #Create my function for the tables fxdata-function(){ y.row=c(0,1,2,3,4,5) yy=c(rep(0,6)) w=data.frame(A3=yy,A2=yy,A1=yy,A0=yy)

Re: [R] Pearson III distribution

2014-05-10 Thread Ilaria Prosdocimi
NOELIA LEGAL noelialegal at hotmail.com writes: Please I need your help.I'm intrested to know if there is any R-package for fit a Pearson III extreme value distribution to data.Thanks a lot Noelia [[alternative HTML version deleted]]

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread Barry Rowlingson
On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does not work the same way as is.character() or

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread Duncan Murdoch
On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does

Re: [R] adding rows

2014-05-10 Thread arun
HI, If you want to try other ways: fun1 - function(mat, rowN) {     dm - dim(mat)[1]     rowN1 - rowN - 1     indx - rep(1:rowN, dm - rowN1) + rep(seq(0, dm - rowN), each = rowN)     indx1 - (seq_along(indx)-1)%/%rowN+1     as.vector(tapply(indx, list(indx1), FUN = function(i) sum(mat[i, ]))) }

Re: [R] adding rows

2014-05-10 Thread eliza botto
Thankyou very much arun. Its always nice to hear from you. Eliza Date: Sat, 10 May 2014 03:55:29 -0700 From: smartpink...@yahoo.com Subject: Re: [R] adding rows To: r-help@r-project.org CC: ruipbarra...@sapo.pt; eliza_bo...@hotmail.com HI, If you want to try other ways: fun1 -

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread peter dalgaard
On 10 May 2014, at 12:54 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects *

[R] variable length lisin in data frame

2014-05-10 Thread Ragia Ibrahim
Dear Group, I have data like the following id contacts_list number of contacts --- 1 3 4 2 2 1 3 43 34 2 1 3 411

Re: [R] variable length lisin in data frame

2014-05-10 Thread Duncan Murdoch
On 10/05/2014, 7:46 AM, Ragia Ibrahim wrote: Dear Group, I have data like the following id contacts_list number of contacts --- 1 3 4 2 2 1 3 43 34 2 1

Re: [R] Extracting the names of coefficients of random effects

2014-05-10 Thread Brian Willis
Thanks, modifying the predict function to allow for new levels was what was required Brian -- View this message in context: http://r.789695.n4.nabble.com/Extracting-the-names-of-coefficients-of-random-effects-tp4689109p4690298.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] variable length lisin in data frame

2014-05-10 Thread arun
Hi, Try:  dat - data.frame(id=1:4, contacts_list=I(list(3:4,c(1,3,4), c(4,2,1), 1)), `number of contacts`=c(2,3,3,1),check.names=FALSE) attr(dat$contacts_list,class) - NULL #if needed  dat A.K. Dear Group, I have data like the following id   contacts_list   number of contacts

Re: [R] recall variable in a loop

2014-05-10 Thread Jeff Newmiller
One answer to your question might be ?get. A way better answer is to never use assign to create xx1 etc in the first place but to store those results in a list that you can simply index later. If you were to create a reproducible example [1] by defining mydata you would be more likely to get an

Re: [R] variable length lisin in data frame

2014-05-10 Thread William Dunlap
d - data.frame(id=1:4, no.contacts=c(2,3,3,1)) d$contacts_list - list(3:4, c(1,3,4), c(4,2,1), 1 ) If you store that information in a longer format, with each row being an edge to the relationship graph, it can make further processing easier: d2 - with(d, data.frame(id=rep(id,

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread David Winsemius
On May 10, 2014, at 3:54 AM, Duncan Murdoch wrote: On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not

Re: [R] create dataframe using structure ()

2014-05-10 Thread Luigi Marongiu
Hello, I have tried to apply this approach -- which worked for this example -- to a larger dataset. Although I have not received error messages, the variable I have set (my.data) is empty. Do you have any tip about this? Many thanks Luigi # code:: my.data-structure(list( column_1 = 1:120,

Re: [R] create dataframe using structure ()

2014-05-10 Thread arun
Hi, --- 2767.493803,4796.33016,12292.93705,3864.657567,9380.673835,14886.44683,8457.88646,26050.47191))),#   .Names = c(row, stimulation, positivity, group, copy), row.names = c(NA, -120L),  class = data.frame)  str(my.data) 'data.frame':    120

Re: [R] create dataframe using structure ()

2014-05-10 Thread William Dunlap
You made the same error as the first time - a misplaced parenthesis. Make the last 2 lines .Names = c(row, stimulation, positivity, group, copy)), row.names=c(NA, 120L), class=data.frame) instead of .Names = c(row, stimulation, positivity, group, copy), row.names = c(NA, -120L)), class

Re: [R] create dataframe using structure ()

2014-05-10 Thread William Dunlap
And I misplaced the closing parenthesis in my reponse - it goes before the .Names attribute as well. Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, May 10, 2014 at 11:36 AM, William Dunlap wdun...@tibco.com wrote: You made the same error as the first time - a misplaced parenthesis. Make

[R] Does lmrob() account for autocorrelation and heteroskedasticity?

2014-05-10 Thread David Wang
Hello, I'm a novice R user. I'd like to estimate the linear trends (b) and their statistical significance (p-value) of quite a few univariate time series. Because several time series show autocorrelation and heteroskedasticity, the ordinary least squares method lm(), as I understand it, isn't the

[R] How to change the font size on the title of a xyplot

2014-05-10 Thread Eduardo M. A. M. Mendes
Hello I am using xyplot (lattice) to plot a xts variable. There are 20 variables within the xts variable (index by a datetime vector sampled every 1 minute). The results are very nice and help me to understand what is going on with the data. However since the names (labels of each variable)

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread David Winsemius
On May 10, 2014, at 2:26 PM, Eduardo M. A. M. Mendes wrote: Hello I am using xyplot (lattice) to plot a xts variable. There are 20 variables within the xts variable (index by a datetime vector sampled every 1 minute). The results are very nice and help me to understand what is going on

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Eduardo M. A. M. Mendes
Hello Many thanks. par.main.text is the main title (on top of all plots). I need to change the each of the titles in the, say, subplots. Ed On May 10, 2014, at 7:05 PM, David Winsemius dwinsem...@comcast.net wrote: On May 10, 2014, at 2:26 PM, Eduardo M. A. M. Mendes wrote: Hello

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread David Winsemius
On May 10, 2014, at 3:30 PM, Eduardo M. A. M. Mendes wrote: Hello Many thanks. par.main.text is the main title (on top of all plots). I need to change the each of the titles in the, say, subplots. One gets the response the fills ones needs when those needs are clearly expressed and

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Eduardo M. A. M. Mendes
Yes, you are right. I meant panels, xyplot generates 22 panels, which one with y-axis, x-axis and a title. I need to change the font size of title in the panels. Ed On May 10, 2014, at 8:04 PM, David Winsemius dwinsem...@comcast.net wrote: On May 10, 2014, at 3:30 PM, Eduardo M. A.

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread David Winsemius
On May 10, 2014, at 5:47 PM, Eduardo M. A. M. Mendes wrote: Yes, you are right. I meant panels, xyplot generates 22 panels, which one with y-axis, x-axis and a title. I need to change the font size of title in the panels. It appears to me that the answer is probably in :

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Eduardo M. A. M. Mendes
library(zoo); library(lattice); a=matrix(runif(100),25,4); b=zoo(a,seq(1,25)); names(b)=c(How to change the font size?,2,3,4); xyplot(b) Ed On May 10, 2014, at 9:52 PM, David Winsemius dwinsem...@comcast.net wrote: On May 10, 2014, at 5:47 PM, Eduardo M. A. M. Mendes wrote: Yes, you are

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread David Winsemius
On May 10, 2014, at 6:06 PM, Eduardo M. A. M. Mendes wrote: library(zoo); library(lattice); a=matrix(runif(100),25,4); b=zoo(a,seq(1,25)); names(b)=c(How to change the font size?,2,3,4); xyplot(b) xyplot(b, strip=strip.custom( par.strip.text=list(cex=.5))) -- David. Ed On May

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Eduardo M. A. M. Mendes
cex=0.85 did the job for me. many thanks Ed On May 10, 2014, at 10:13 PM, David Winsemius dwinsem...@comcast.net wrote: On May 10, 2014, at 6:06 PM, Eduardo M. A. M. Mendes wrote: library(zoo); library(lattice); a=matrix(runif(100),25,4); b=zoo(a,seq(1,25)); names(b)=c(How to

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Duncan Mackay
Hi Just an addition for the future : If you wanted to have different main title plots to the same device then par.settings can be used for each plot xyplot(1 ~1, par.settings = list(par.main.text = 0.85, par.sub.text = 0.85)

Re: [R] How to change the font size on the title of a xyplot

2014-05-10 Thread Greg Johnson`
Eduardo M. A. M. Mendes emammendes at gmail.com writes: Hello I am using xyplot (lattice) to plot a xts variable. There are 20 variables within the xts variable (index by a datetime vector sampled every 1 minute). The results are very nice and help me to understand what is going on

[R-es] Duda_TEST DE WALD

2014-05-10 Thread Lorena Tudela Marco
Hola a todos y todas, Gracias por vuestro apoyo en cantidad de preguntas anteriores, de nuevo os escribo para compartir una duda: Estoy trabajando con un modelo bien sencillo, es una regresión simple, pero me gustaría comprobar la significación estadística de cada uno de los coeficientes de