Re: [R] keep average values and delete duplicate rows

2012-10-28 Thread Jeff Newmiller
Please read the posting guide... this is not a homework help line. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] keep average values and delete duplicate rows

2012-10-28 Thread arun
HI, I guess it is a bit confusing as to what you want.  In the example dataset, there was no democracy_index, but in the result you want it.  Regarding the median calculation, I guess you want to calculate the median for each country.  I created one more country (China) with fake data.  May

Re: [R] Encoding

2012-10-28 Thread Eva Prieto Castro
Hi again, Duncan: I understand you tell me, but I don't reach it runs in Mac. How must I do?. Thanks. Eva --- El sáb, 27/10/12, Duncan Murdoch murdoch.dun...@gmail.com escribió: De: Duncan Murdoch murdoch.dun...@gmail.com Asunto: Re: [R] Encoding Para: Eva Prieto Castro evapcas...@yahoo.es

[R] Having some Trouble Data Structures

2012-10-28 Thread Benjamin Ward (ENV)
Hi All, I'm trying to run a simulation of host-pathogen evolution based around individuals. What I need to have is a dataframe or table of some description - describing all the individuals of a pathogen population (so far I've implemented this as a matrix): ID No_of_Effectors

Re: [R] keep average values and delete duplicate rows

2012-10-28 Thread fuckecon
Hi Arun, Thanks for replying. Sorry I didn't list it, I do have democracy index in my dataset. The full set includes these columns: Country Code (3 letter abbreviation) Country Education Freedom house demo index log population log real gdp nominal savings polity demo index year (5 yr

Re: [R] Grid Width in polar.plot

2012-10-28 Thread Jim Lemon
On 10/27/2012 12:48 AM, MartinD wrote: Hello, I am using the polar.plot function from plotrix. Is there a way to change the width of the grid lines? grid.lwd doesn't work Hi Martin, At the moment, there is no option for changing the width of the grid lines. However, I have had a

Re: [R] keep average values and delete duplicate rows

2012-10-28 Thread fuckecon
Hi Jeff, Sorry for the misunderstanding. I may have phrased my question as such, but my intention is really learn the workings of R. I am trying to replicate the results from an econometric paper in R, and I don't have any experience. I will reconsider my posts in the future. Regards, --

Re: [R] Encoding

2012-10-28 Thread Duncan Murdoch
On 12-10-28 3:49 AM, Eva Prieto Castro wrote: Hi again, Duncan: I understand you tell me, but I don't reach it runs in Mac. How must I do?. There is a function in the tools package called showNonASCIIfile. If you run it on each source file in your package, you may detect other non-ASCII

Re: [R] Encoding

2012-10-28 Thread Duncan Murdoch
On 12-10-28 7:56 AM, Eva Prieto Castro wrote: Hi Duncan, What dos it happen if I need use non-ASCII characters?. Is there no way in order to make the package in Windows PC and it runs on Mac?. As I said: always use the same encoding for them, and declare it in the DESCRIPTION file. See

[R] In is.euclid(m2) : Zero distance(s)

2012-10-28 Thread eliza botto
Dear useRs,i am applying mantel test to find the correlation between distance matrices, by ade4 package. some of the correlations, although given me r-values, have shown following warning message.. In is.euclid(m2) : Zero distance(s) i wanted to know that why has this message prompted? although

Re: [R] Having some Trouble Data Structures

2012-10-28 Thread Uwe Ligges
On 28.10.2012 10:32, Benjamin Ward (ENV) wrote: Hi All, I'm trying to run a simulation of host-pathogen evolution based around individuals. What I need to have is a dataframe or table of some description - describing all the individuals of a pathogen population (so far I've implemented this

Re: [R] Having some Trouble Data Structures

2012-10-28 Thread Jeff Newmiller
Search on ragged array. My preferred approach is to use a data frame with one row per effector that repeats the per-ID information. If that occupies too much memory, you can setup another data frame with one row per ID and refer to that information as using lapply and subset the effectors

Re: [R] Encoding

2012-10-28 Thread Duncan Murdoch
On 12-10-28 10:57 AM, Eva Prieto Castro wrote: Hi Duncan: The problem is that in Windows I can't do the source() with encoding=utf-8, so I don't reach the step of adjusting DESCRIPTION file. The DESCRIPTION file is a plain text file, not R code. You don't need to source() it, you just edit

[R] lbfgsb from C

2012-10-28 Thread axionator
Hi, I wanted to use R's lbfgsb method for minimization from C. Unfortunately, my toy examples always crashes (segmentation fault). What's wrong with it? double eval(int n, double* par, void *ex) { double result = 0; for (int i=0; in; ++i) { result += par[i]*par[i]; }

Re: [R] Encoding

2012-10-28 Thread Eva Prieto Castro
Hi Duncan, What dos it happen if I need use non-ASCII characters?. Is there no way in order to make the package in Windows PC and it runs on Mac?. I am lost, very lost. Thanks. Eva --- El dom, 28/10/12, Duncan Murdoch murdoch.dun...@gmail.com escribió: De: Duncan Murdoch

Re: [R] interpreting repeated measures mixed model

2012-10-28 Thread gaiarrido
nobody? please - Mario Garrido Escudero PhD student Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola Universidad de Salamanca -- View this message in context: http://r.789695.n4.nabble.com/interpreting-repeated-measures-mixed-model-tp4647652p4647689.html Sent

Re: [R] summation sign

2012-10-28 Thread arun
Hi Sara, Not very clear either. You mentioned you want to repeat the sum 5 times.  Is it on the same x variable or different x variables? If you want to repeat the sum 5 times on the same x variable, x1-c(.3,.2,.1)  fun1-function(x,i){  res-lapply(1:i,function(y) -sum(log(1-x^2)))  

[R] Best fitted curve

2012-10-28 Thread cslc2
Hi I have trouble making a best fitted curve for a xy-plot. My data consist of two groups with four repititions for each x-value. plot(weight~gdd,data=weight,pch=as.numeric(species)) http://r.789695.n4.nabble.com/file/n4647692/Weight.jpeg Can you help? Cecilie -- View this message in

Re: [R] Having some Trouble Data Structures

2012-10-28 Thread arun
Hi, In addition to using paste(), you can also try this: dat1-data.frame(ID=formatC(0001:0010,width=4,flag=0),No_of_Effectors=rep(3,10)) dat1-within(dat1,{ID-as.character(ID)}) list1-lapply(1:nrow(dat1),function(x) sample(1:1,3,replace=TRUE)) dat2-data.frame(dat1,Effectors=I(list1))  

Re: [R] Encoding

2012-10-28 Thread Eva Prieto Castro
Hi Duncan: The problem is that in Windows I can't do the source() with encoding=utf-8, so I don't reach the step of adjusting DESCRIPTION file. Eva --- El dom, 28/10/12, Duncan Murdoch murdoch.dun...@gmail.com escribió: De: Duncan Murdoch murdoch.dun...@gmail.com Asunto: Re: [R] Encoding

Re: [R] error bars

2012-10-28 Thread Johnson, Franklin Theodore
Hello R-help, Thanks to everyone for the prompt replies. Yes. I didn't reinstal the Hmisc package after updating R to the recent version. This worked. Thank you so, much! I'm relieved that I was able to update my charts just prior to my presentation. You'll are awesome. Best Regards, Franklin

Re: [R] Having some Trouble Data Structures

2012-10-28 Thread arun
HI, May be this helps. dat1-data.frame(ID=formatC(0001:0010,width=4,flag=0),No_of_Effectors=rep(3,10)) dat1-within(dat1,{ID-as.character(ID)}) list1-lapply(1:nrow(dat1),function(x) paste(sample(1:1,3,replace=TRUE)),sep=,)

Re: [R] Best fitted curve

2012-10-28 Thread andrewcd
Looking at that data, it looks like the two species respond differently to GDD. Fitting a curve means first defining and then fitting a model that, once fit, has fitted values that will give you the curve that you wold like to draw. The simplest would be a series regression with interaction

Re: [R] Trouble with first passage time analysis using adehabitatLT

2012-10-28 Thread zlong
I was able to answer a few of my question on my own. The units for the Y-axis can be set to days with the following: /fpt(fit1, seq(length=5), units=days) / This sets the y-axis units to 'days', defines the number of radii (5), and removes the scaling function that wasn't really necessary for my

Re: [R] wanna create all points.....

2012-10-28 Thread Rui Barradas
Hello, You had enough answers to variants of this question to already know to open a graphics device once and _just_ once using plot() and then, in the loop, use points(). plot(1, type = n, xlim = c(0, 20), ylim = c(0, 8), ylab=sample mean, xlab=sample size) for (i in seq(1:20)){

[R] Hausman test in R

2012-10-28 Thread fxen3k
Hi there, I am really new to statistics in R and statistics itself as well. My situation: I ran a lot of OLS regressions with different independent variables. (using the lm() function). After having done that, I know there is endogeneity due to omitted variables. (or perhaps due to any other

Re: [R] interpreting repeated measures mixed model

2012-10-28 Thread arun
HI Mario, I think you will get more response if you post at R mixed models (r-sig-mixed-mod...@r-project.org) mailing list. A.k. - Original Message - From: gaiarrido gaiarr...@usal.es To: r-help@r-project.org Cc: Sent: Sunday, October 28, 2012 7:42 AM Subject: Re: [R] interpreting

Re: [R] Hausman test in R

2012-10-28 Thread Bert Gunter
1. These are primarily statistics issues, not R issues. You should post on a statistical help list like stats.stackexchange.com, not here. 2. However, given your acknowledged statistical ignorance, you may be asking for trouble. I suggest you seek help from a local statistical expert to get you

[R] List of arrays - problem with dimensions

2012-10-28 Thread Loukia Spineli
Dear all, I want to obtain the following result [[1]] , , 1, 1 [,1] [,2] [1,]11 [2,]11 , , 2, 1 [,1] [,2] [1,]11 [2,]11 , , 9, 1 [,1] [,2] [1,]11 [2,]11 , , 10, 1 [,1] [,2] [1,]11 [2,]11

Re: [R] Hausman test in R

2012-10-28 Thread Joshua Wiley
Hi, I can think of no reason a Hausman test could not be used for OLS---it is a comparison of vectors of coefficients from different models usually assumed to produce similar estimates under certain conditions. Dissimilarity is taken as indicative of a lack of some or all the conditions required

Re: [R] List of arrays - problem with dimensions

2012-10-28 Thread Richard M. Heiberger
Your example is hard to understand because it includes multiple copies of the number 1. Let me do something with different values and see if it gets what you are after. Your code as posted can't work because the variable n is not defined. result - list(a=array(1:48, dim=c(2,2,3,4)),

Re: [R] List of arrays - problem with dimensions

2012-10-28 Thread Loukia Spineli
I am refreshing the code for the problem x = c( 4 , 4 , 0 ) y = c( 1 , 0 , 2 ) t = c( 1 , 2, 2 ) r-as.vector(table(t)) Nx-vector(list,length(unique(t))) Ny-vector(list,length(unique(t))) n-vector(list,length(unique(t))) for(i in 1:length(unique(t))){

[R] Why are coefficient estimates using ML and REML are different in lme?

2012-10-28 Thread Houhou Li
Hi, All,   My data collection is from 4 regions (a, b, c, d). Within each region, it has 2 or 3 units. Within each unit, it has measurement from about 25 sample site. I was trying to use lme function to discribe relationship between y and a few covariates. Both y and covariates were measured at

Re: [R] List of arrays - problem with dimensions

2012-10-28 Thread Richard M. Heiberger
This time the code works, except for the spurious } at the end. I still don't know what the goal is. Please help yourself and us by putting spaces around assignment arrows a - b instead of the hard-to-read a-b and putting spaces after , ## Let a - 12 ## Does a-3 ## mean a - 3 ## or a -3 ## ?

Re: [R] List of arrays - problem with dimensions

2012-10-28 Thread Loukia Spineli
x = c( 4 , 4 , 0 ) y = c( 1 , 0 , 2 ) t = c( 1 , 2, 2 ) r - as.vector(table(t)) Nx - vector(list,length(unique(t))) Ny - vector(list,length(unique(t))) n - vector(list,length(unique(t))) for(i in 1:length(unique(t))){ Nx[[i]] - array(0,dim=c(1,r[i],1))+x[t==i]+1 Ny[[i]] -

Re: [R] Stata Database R

2012-10-28 Thread S Ellison
A look at the R data import/export page supplied in the R HTML help system (see the link at top left) says that stata files are handled by the foreign package. S Ellison From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of

Re: [R] Trouble with first passage time analysis using adehabitatLT

2012-10-28 Thread Michael Sumner
You ought to contact the package author or try the specialist lists animov or R -Sig-Geo for this topic. Cheers, Mike On Monday, October 29, 2012, zlong wrote: I was able to answer a few of my question on my own. The units for the Y-axis can be set to days with the following: /fpt(fit1,

[R] change lm log(x) to glm poisson

2012-10-28 Thread Elaine Kuo
Hello list, I am running a regression using lm(Y~A+B+log(C)+log(D)) Now, I would like to test if glm can produce similar results. So the code was revised as glm(Y~A+B+C+D, family=poisson) (code 1) However, I found some example using glm for lm. It suggests that the code should be revised

Re: [R] change lm log(x) to glm poisson

2012-10-28 Thread Joshua Wiley
Hi Elaine, If you want identical models, you need to use the same family and then the formula is the same. Here is an example with a built in dataset: ## these two are identical coef(lm(mpg ~ hp + log(wt), data = mtcars)) (Intercept) hp log(wt) 38.86095585 -0.02808968

Re: [R] change lm log(x) to glm poisson

2012-10-28 Thread Mark Leeds
Hi Josh and Elaine: John Fox's CAR book ( the companion to his applied regression text ) is really great for implementing GLMs in R. It also has a brief but quality discussion of the theory behind them. His text goes into more detail. Dobson's Introduction to generalized linear models is also

Re: [R] PROBLEMS INSTALLING LIFEMETRICS

2012-10-28 Thread Jeff Newmiller
If your goal is to use Excel with R, or if you are having difficulty getting Lifehacker to work with Excel, perhaps you should go to http://rcom.univie.ac.at/. You don't need Lifehacker to use Excel with R, though (as you stated your problem). That just needs Statconn (which is off topic