Re: [R] Anova, F statistics, P-values

2012-10-06 Thread Jhope
Thank you for the replies. I am actually trying to gain p-values and f values, and tried the below script but unsuccessful. 1) I have read in another forum to use the package lmer but apparently it does not exist. 2) Then I tried the pvals.fnc but it is not a function. 3) I read also that a

[R] SPM/SemiPar -- Plotting additive interactions

2012-10-06 Thread Andrew Crane-Droesch
I'm taking the residual-regression approach to semiparametric estimation (Robinson 1988, Econometrica), and basically using SemiPar simply as a convenient means of doing multivariate nonparamteric additive models. The final bit of code is here: finalfit -

[R] Presence/ absence data from matrix to single column

2012-10-06 Thread Andrea Goijman
I've been trying to reshape this database but haven't succeed at it. I tried using loops but can't get it right. I just want to reshape my database from this matrix, to the one below, with only one column of data. Year Route Point Sp1 Sp2 Sp3 2004 123 123-1 0 1 0 2004 123 123-2 0 1 1 2004 123

[R] Expected number of events, Andersen-Gill model fit via coxph in package survival

2012-10-06 Thread Omar De la Cruz C.
Hello, I am interested in producing the expected number of events, in a recurring events setting. I am using the Andersen-Gill model, as fit by the function coxph in the package survival. I need to produce expected numbers of events for a cohort, cumulatively, at several fixed times. My ultimate

Re: [R] geoRglm with factor variable as covariable

2012-10-06 Thread Ruben
On 10/4/2012 10:39 PM, Filoche wrote: Dear R users. I'm trying to fit a generalised linear spatial mode using the geoRglm package. To do so, I'm preparing my data (geodata) as follow: geoData9093 = as.geodata(data9093, coords.col= 17:18, data.col=15,* covar.col=16*) where covar.col is a

[R] BCA Package Doubts

2012-10-06 Thread kokila
Hi .., In create.samples() function how to calculate Estimation,validation,Holdout .I got the answer in this function.But I dont know how the function is working.please Reply this..Iam Waiting for Reply... See this below example and reply me... Example: data(cars)

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread fxen3k
Hi, the first command was bringing the numbers into R directly: * testdata - c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, -0.2353086361784190, 0.0667195538296534, 0.1755852636926560) mean(testdata) [1] 0.0161584*

[R] Download limit

2012-10-06 Thread agiani99
Hi all, I am trying to use in RStudio the latest code given in https://github.com/systematicinvestor/SIT/blob/master/R/bt.test.r, which seems to work fine but with the following warning for download limits (one for each of the tickers). I searched in options() something which could be related

[R] warning in summary(aov())

2012-10-06 Thread Jhope
Hi R-listers, I am receiving an error - see below. Aeventexhumed is the event in which nesting occured, so it is defined by A, B, C. I thought as a factor was ok, tried to change it to as.character but it still gave me the same error. Is there something I should do about this error or just ignore

[R] vector is not assigned correctly in for loop

2012-10-06 Thread 周果
Hi there, Here is a minimum working example: lower = 0 upper = 1 n_bins = 50 interval = (upper - lower) / n_bins bins = vector(mode=numeric, length=n_bins) breaks = seq(from=lower + interval, to=upper, by=interval) for(idx in

Re: [R] Creating vegetation distance groups from one column

2012-10-06 Thread Rui Barradas
Hello, My example with 'x' was just that, an example. Inline. Em 06-10-2012 00:03, Jhope escreveu: Hi, I have tried the script posted but received the following errors. I hope I copied it correctly. I'm sorry but I don't know how to alter the script myself. Please advise, Jean x - 0:30 +

Re: [R] vector is not assigned correctly in for loop

2012-10-06 Thread Berend Hasselman
On 06-10-2012, at 08:14, 周果 guo.c...@gmail.com wrote: Hi there, Here is a minimum working example: lower = 0 upper = 1 n_bins = 50 interval = (upper - lower) / n_bins bins = vector(mode=numeric, length=n_bins) breaks =

Re: [R] vector is not assigned correctly in for loop

2012-10-06 Thread R. Michael Weylandt
Forgot to cc the list. RMW On Sat, Oct 6, 2012 at 11:29 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: A case study of a good question! Would that all posters did such a good job. On Sat, Oct 6, 2012 at 7:14 AM, 周果 guo.c...@gmail.com wrote: Hi there, Here is a minimum working

Re: [R] Download limit

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 8:19 AM, agiani99 agian...@hotmail.com wrote: Hi all, I am trying to use in RStudio the latest code given in https://github.com/systematicinvestor/SIT/blob/master/R/bt.test.r, which seems to work fine but with the following warning for download limits (one for each of

Re: [R] warning in summary(aov())

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 9:12 AM, Jhope jeanwaij...@gmail.com wrote: Hi R-listers, I am receiving an error - see below. Aeventexhumed is the event in which nesting occured, so it is defined by A, B, C. I thought as a factor was ok, tried to change it to as.character but it still gave me the

Re: [R] vector is not assigned correctly in for loop

2012-10-06 Thread Rui Barradas
Hello, This seems to be a case for FAQ 7.31 Why doesn't R think these numbers are equal? See this example: 3/5 - 1/5 - 2/5 # not zero 3/5 - (1/5 + 2/5) # not zero, different from above In your case, try for(idx in breaks){ print(idx / interval, digits = 16) # see problem indices

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 9:11 AM, fxen3k f.seha...@gmail.com wrote: Hi, the first command was bringing the numbers into R directly: * testdata - c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, -0.2353086361784190,

Re: [R] svyhist

2012-10-06 Thread Anthony Damico
?ylim says numeric vectors of length 2 - so just the beginning and end. ?svyhist doesn't specifically mention the ylim parameter, meaning you should look for a ... in the arguments list and click through to the page for ?hist ?hist has an example that shows the ylim parameter only containing

Re: [R] arrange data

2012-10-06 Thread Rui Barradas
Hello, Using Arun's data example, instead of creating a factor convert to 4 digits years. set.seed(1) dat1 - data.frame(Tahun=rep(c(98:99,00),each=36), Bahun=rep(rep(1:12,times=3),each=3), x=sample(1:500,108,replace=TRUE)) dat2 - dat1 # operate on a copy dat2$Tahun -

Re: [R] Dúvida função Anova pacote car - Medidas repetidas

2012-10-06 Thread Rui Barradas
Hello, Yes, your Spanish is close enough to Portuguese for you to understand it. I thought it was homework and didn't read untill the end. Apologies to Diego, and thanks to John. Rui Barradas Em 05-10-2012 22:48, John Fox escreveu: Dear Diego, This is close enough to Spanish for me to

Re: [R] Dúvida função Anova pacote car - Medidas repetidas

2012-10-06 Thread Rui Barradas
Sorry, Phone, daughter, forgot to sign. Rui Barradas Em 06-10-2012 12:28, Rui Barradas escreveu: Hello, Yes, your Spanish is close enough to Portuguese for you to understand it. I thought it was homework and didn't read untill the end. Apologies to Diego, and thanks to John. Rui Barradas

Re: [R] Download limit

2012-10-06 Thread agiani99
Hi Michael, I am not under firewall, but I noticed that when I setInternet2=FALSE the problem disappears. SetInternet2=TRUE is required to download Systematic Investor Toolbox (SIT). I don't know why or whether it makes sense, but yes it seems a connection problem and no it seems to have

Re: [R] LaTeX consistent publication graphics from R and Comparison of GLE and R

2012-10-06 Thread Frank Harrell
Hi Marc, It would be interesting to compare with tikz for ease of use. As an aside I've been wishing that someone would write an R function for creating clinical trial disposition charts using tikz or pstricks ... Best, Frank Marc Schwartz-3 wrote On Oct 5, 2012, at 3:32 PM, clangkamp lt;

Re: [R] vector is not assigned correctly in for loop

2012-10-06 Thread Bert Gunter
But the OP should not be doing this **at all.** He apparently has not bothered to read the Intro to R tutorial as he appears not to know about vectorized calculations. -- Bert On Sat, Oct 6, 2012 at 3:29 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Forgot to cc the list. RMW On

[R] Presence/ absence data from matrix to single column

2012-10-06 Thread agoijman
I've been trying to reshape this database but haven't succeed at it. I tried using loops but can't get it right. I just want to reshape my database from this matrix, to the one below, with only one column of data. YearRoute Point Sp1 Sp2 Sp3 2004123 123-1 0 1

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread arun
Hi, Try this: dat1-read.table(text= Year    Route    Point    Sp1    Sp2    Sp3 2004    123    123-1    0    1    0 2004    123    123-2    0    1    1 2004    123    123-10    1    1    0 ,header=TRUE,sep=,stringsAsFactors=FALSE) library(reshape) melt(dat1,id=c(Year,Route,Point))   Year Route 

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread John Kane
Try the reshape2 package. You will probablly have to install the package. install.packages(reshape2) with your data as xx : library(reshape2) melt(xx, id =c(Year, Route, Point)) seems to do what you want. John Kane Kingston ON Canada -Original Message- From:

Re: [R] arrange data

2012-10-06 Thread arun
Hi Roslina, Extending Rui's solution if you want only the last two digits for Year.   agg_dt1$Tahun-as.numeric(gsub(\\d{2}(\\d+),\\1,agg_dt1$Tahun))  head(agg_dt1) #  Tahun Bahun    x #1    98 1  607 #2    99 1  814 #3 0 1  580 #4    98 2 1006 #5    99 2  941 #6 0

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread arun
Hi John, Thanks for your comments. I have both packages.  I am using R 2.15.  May be reshape is out-of-date.  I don't load reshape2 (may be lazy to add 2 at the end) that much except when I need dcast()   I tried the code with only reshape2 loaded, and is getting the same result.  A.K.

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread John Kane
Where is the csv data coming from? If it is an export from a spreadsheet, Excel (and others?) has a nasty habit of exporting as displayed rather than the actual number as it's default. John Kane Kingston ON Canada -Original Message- From: f.seha...@gmail.com Sent: Sat, 6 Oct

Re: [R] Download limit

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 12:38 PM, agiani99 agian...@hotmail.com wrote: Hi Michael, I am not under firewall, but I noticed that when I setInternet2=FALSE the problem disappears. SetInternet2=TRUE is required to download Systematic Investor Toolbox (SIT). I don't know why or whether it makes

Re: [R] smoothScatter plot

2012-10-06 Thread John Kane
Hi Zhengyu, You might want to have a look at http://gallery.r-enthusiasts.com/graph/Scatterplots_with_smoothed_densities_color_representation,139 which seems to be showing a smoothScatter() that seems like what you want.  I've never used the  function so I am probably not much help Something

Re: [R] Expected number of events, Andersen-Gill model fit via coxph in package survival

2012-10-06 Thread David Winsemius
On Oct 5, 2012, at 8:48 PM, Omar De la Cruz C. wrote: Hello, I am interested in producing the expected number of events, in a recurring events setting. I am using the Andersen-Gill model, as fit by the function coxph in the package survival. I need to produce expected numbers of events

[R] sample

2012-10-06 Thread solafah bh
Hello If I have x=c(3,2,6,1) and n=length(x), are the following codes equivalent?? sample(x,1,replace=TRUE)    and   sample(x,1,replace=TRUE,prob=rep(1/n , n) ) Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread David Winsemius
On Oct 6, 2012, at 1:11 AM, fxen3k wrote: Hi, the first command was bringing the numbers into R directly: * testdata - c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, -0.2353086361784190, 0.0667195538296534,

Re: [R] sample

2012-10-06 Thread R. Michael Weylandt
Yes and no. Same effect, but you won't get the same random numbers because -- I believe -- a different algorithm is used. grep the source for sample and sample2 if you're interested. Cheers, Michael On Sat, Oct 6, 2012 at 5:02 PM, solafah bh solafa...@yahoo.com wrote: Hello If I have

Re: [R] sample

2012-10-06 Thread arun
Hi, They get different results: with the same set.seed()  x=c(3,2,6,1)  n=length(x)  set.seed(1)  sample(x,1,replace=TRUE)  #[1] 2 set.seed(1)  sample(x,1,replace=TRUE,prob=rep(1/n , n) ) #[1] 6  identical(sample(x,1,replace=TRUE),sample(x,1,replace=TRUE,prob=rep(1/n , n) )) #[1] FALSE A.K.

Re: [R] LaTeX consistent publication graphics from R and Comparison of GLE and R

2012-10-06 Thread Marc Schwartz
Hi Frank, I have not used tikz, so am not sure. I have been hand coding the TeX markup in the .Rnw files to date, since each study has been somewhat different in terms of various characteristics and the sponsors, in some cases, have requested some customizations to the flow charts. That has

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread William Dunlap
For nine numbers, R-helpers should recommend that people show their data with dput(obj) instead of str(obj). dput() shows everything in the object to full precision. str() shows a summary of the object and rounds numbers to 2 digits -- it is good for an overview of the data, but when the question

Re: [R] Multiple graphs boxplot

2012-10-06 Thread John Kane
Does something like this make any sense? library(reshape2) library(ggplot2) yy - structure(list(A = c(23, 21, 21, 20, 19, 19), B = c(20, 18, 20, 19, 20, 18), C = c(15, 15, 15, 12, 13, 13)), .Names = c(A, B, C), class = data.frame, row.names = c(NA, -6L)) y1 - melt(yy) # using reshape2

Re: [R] help with making figures

2012-10-06 Thread Uwe Ligges
On 05.10.2012 21:59, megalops wrote: Bert, Can you help me understand your suggestion? Megalops31, which suggestion? You failed to quote former messages! I don't understand how I can include all 30 sites under the label called site in the xypot What is an xypot example? Please read the

[R] sample with equal probabilities

2012-10-06 Thread solafah bh
Hello If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one value from x , and each value of x has equal probability to appear (1/n). Are the following codes equivalent?? sample(x,1,replace=TRUE)  and   sample(x,1,replace=TRUE,prob=rep(1/n , n))   Regards

Re: [R] sample with equal probabilities

2012-10-06 Thread R. Michael Weylandt
Please don't double post. And see my response to you here: https://stat.ethz.ch/pipermail/r-help/2012-October/325470.html Michael On Sat, Oct 6, 2012 at 6:51 PM, solafah bh solafa...@yahoo.com wrote: Hello If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one value

Re: [R] vector is not assigned correctly in for loop

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 3:23 PM, Bert Gunter gunter.ber...@gene.com wrote: But the OP should not be doing this **at all.** He apparently has not bothered to read the Intro to R tutorial as he appears not to know about vectorized calculations. -- Bert I don't really think that's relevant or

Re: [R] Test for Random Points on a Sphere

2012-10-06 Thread cberry
Lorenzo Isella lorenzo.ise...@gmail.com writes: Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere

Re: [R] ffbase, help with %in%

2012-10-06 Thread Jan
Hello, You are trying to index based on a logical ff vector instead of based on a integer ff vector. Indexing based logical ff vectors are only allowed since version 0.6 of the package which is not on CRAN currently yet. Jan -- View this message in context:

Re: [R] LaTeX consistent publication graphics from R and Comparison of GLE and R

2012-10-06 Thread clangkamp
I had a brief look at PSTricks, and really quite like it. There is however one catch, like Sweave etc. it is assumed to be processed along with the LaTeX. I find these things rather annoying, as it is just a major and unnecessary error source. I think it is much better to produce single objects

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread fxen3k
I created a Microsoft Excel spreadsheet. As you said, I only have as displayed numbers. I just solved the problem by showing 25 decimal places in Excel and then exported the data into a CSV-file. Is there a better way to solve this? Regards, Felix -- View this message in context:

[R] R Update Failed !!!

2012-10-06 Thread Jhope
Hi R-listers, I just tried updating my R and now I can't even open it and it is prompting me to relaunch then relaunch just reappears. And it will not open R. I am afraid I may have lost my scripts. What should I do? I am running a MacBook OS X Version 10.5.8 1) Restore the entire system to

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread agoijman
Works fantastic!!! thank you SO much -- View this message in context: http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645302.html Sent from the R help mailing list archive at Nabble.com. __

[R] multinomial MCMCglmm

2012-10-06 Thread Vaniscotte
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set is a trapping data set, where the observation at each trap (1 or 0 for several species) have been aggregated per trapline (i.e. 25 traps). Therefore

[R] multinomial MCMCglmm

2012-10-06 Thread Vaniscotte
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set is a trapping data set, where the observation at each trap (1 or 0 for several species) have been aggregated per trapline (i.e. 25 traps). Therefore

Re: [R] R Update Failed !!!

2012-10-06 Thread R. Michael Weylandt michael.weyla...@gmail.com
This is being handled on R-SIG-Mac. Please disregard here. Michael On Oct 6, 2012, at 9:05 PM, Jhope jeanwaij...@gmail.com wrote: Hi R-listers, I just tried updating my R and now I can't even open it and it is prompting me to relaunch then relaunch just reappears. And it will not open R.

[R] Quantile Granger causality

2012-10-06 Thread Massimo Schiavo
Good evening (in Italy), Someone of you have ever read anything about quantile cointegration? I want to use the test statistic explained in Chuang et al. (2009), that fundamentally followed the suggestion of Koenker and Machado (1999). This is a Wald test used for quantile cointegration

[R] multinomial MCMCglmm

2012-10-06 Thread Vaniscotte
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set is a trapping data set, where the observation at each trap (1 or 0 for several species) have been aggregated per trapline (i.e. 25 traps). Therefore

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Oct 6, 2012, at 4:54 PM, fxen3k f.seha...@gmail.com wrote: I created a Microsoft Excel spreadsheet. As you said, I only have as displayed numbers. I just solved the problem by showing 25 decimal places in Excel and then exported the data into a CSV-file. Is there a better way to solve

[R] two indirect effects of path analysis

2012-10-06 Thread Elaine Kuo
Hello, This is Elaine. I am trying a path analysis using lavaan Package. There are three explanatory variables: X, Z, and M. The response variable is Y. A, b, and c have direct effects on Y. On the other hand, X and Z also have direct effects on M. In other words, X and Z have indirect effects

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread Jim Lemon
On 10/07/2012 01:03 AM, agoijman wrote: I've been trying to reshape this database but haven't succeed at it. I tried using loops but can't get it right. I just want to reshape my database from this matrix, to the one below, with only one column of data. YearRoute Point Sp1 Sp2

Re: [R] svyhist

2012-10-06 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hi Anthony, The ylim () has been added to the code (please see below), and I got 4 plots that have the same y -dimension. Each plot displays 2 distributions - one as histogram from the data and another one as line (i.e., idealized theoretical normal distribution?). My question is, Is there

[R] what exactly is the dim of data set yarn in package pls?

2012-10-06 Thread C W
Hi list, I am looking at the data yarn in package, I don't understand what is dimension of this data set. I did the following: library(pls) data(yarn) dim(yarn) [1] 28 3 head(yarn) NIR.1 NIR.2 NIR.3 NIR.4 NIR.5 NIR.6 NIR.7 NIR.8 NIR.9 NIR.10 NIR.11 1 3.06630

Re: [R] what exactly is the dim of data set yarn in package pls?

2012-10-06 Thread Jeff Newmiller
Perhaps what is wrong is that you need to learn when to use the str() function. str(yarn) --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

Re: [R] what exactly is the dim of data set yarn in package pls?

2012-10-06 Thread C W
I just looked at it again, and I did: is.list(yarn) [1] TRUE So, I guess it's a list with data inside. M On Sat, Oct 6, 2012 at 9:44 PM, C W tmrs...@gmail.com wrote: Hi list, I am looking at the data yarn in package, I don't understand what is dimension of this data set. I did the

Re: [R] what exactly is the dim of data set yarn in package pls?

2012-10-06 Thread C W
Thanks, str() gave me all the info I am looking for. I am too used to dim(), and forgot about list() and str(). Thanks again, -M On Sat, Oct 6, 2012 at 9:57 PM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: Perhaps what is wrong is that you need to learn when to use the str() function.

Re: [R] what exactly is the dim of data set yarn in package pls?

2012-10-06 Thread William Dunlap
Start by using str() to get an idea of the structure of this dataset str(pls::yarn) 'data.frame': 28 obs. of 3 variables: $ NIR: num [1:28, 1:268] 3.07 3.07 3.08 3.08 3.1 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : NULL $ density: num 100 80.2

Re: [R] Presence/ absence data from matrix to single column

2012-10-06 Thread David L Carlson
Also reshape() will work: adat-data.frame(Year=rep(2004,3),Route=rep(123,3), Point=c(123-1,123-2,123-10),Sp1=c(0,0,1), Sp2=c(1,1,1),Sp3=c(0,1,0)) reshape(adat, varying=4:6, v.name=Sp-value, times=c(Sp1, Sp2, Sp3), idvar=Point, timevar=Sp-name, direction=long)