Re: [R] strucchange Fstats() example

2012-05-31 Thread Achim Zeileis
On Thu, 31 May 2012, Mabille, Geraldine wrote: Thanks a lot for your answer Achim, this helped a lot. I have done a lot of reading, following your recommendations and I think I have a better idea of what I should use. My dataset contains binary data on survival of the calf depending on the mas

Re: [R] anova of lme objects (model1, model2) gives different results depending on order of models

2012-05-31 Thread Chris Beeley
Well that's that cleared up then. Thanks to all. Chris B. On 31/05/2012 17:51, Albyn Jones wrote: No, both yield the same result: reject the null hypothesis, which always corresponds to the restricted (smaller) model. albyn On Thu, May 31, 2012 at 12:47:30PM +0100, Chris Beeley wrote: Hello-

[R] Fit lines in intxplot

2012-05-31 Thread arun
Dear R help, I tried to add linear fit lines in intxplot by adding "index.cond = function(x,y) coef(lm(y ~ x))[1]" inside the intxplot().  It didn't help.  I would appreciate any help. My dataset and codes are pasted below. Thanks, A.K. datGreen<- read.table(text=" Time,    DarkSt,    LightSt

Re: [R] How to create a floating bar plot

2012-05-31 Thread Roberto Brunelli
Thanks to both of you, close to the solution, but I think that your proposals do not address the case when a bar is completely positive (or negative): I do not think that the histogram can not be extended easily to this case ... I had a look at the likert function but it is not clear to me if it

[R] Need help in function itemFrequency() function - Apriori Algorithm

2012-05-31 Thread santoshdvn
Hi , I am trying the to implement Apriori algorithm with a sample data set . i am trying to find the itemFrequency of the items in the data set . but i am getting the error as below . i load the data from excel and save the dataset in "mydata" *> itemFrequency(mydata) Error in function (classe

Re: [R] Transform counts into presence/absence

2012-05-31 Thread arun
Hi Duncan, I guess you removed the NA's using a similar function like the one below. Counts<-Counts[sapply(!is.na(Counts),all)] > 1*(Counts>0) [1] 1 0 1 1 0 0 1 1 0 I tried to remove it using other way, Counts[is.na(Counts)]<-''' > Counts  [1] "1"   "0"   "21"  "2"   "0"   "0"   "234" "2"   "

[R] [urgent]arranging data in descending order in each column

2012-05-31 Thread QAMAR MUHAMMAD UZAIR
Dear R users, I have data in the following manner [,1][,2][,3][,4] 6 2 2 2 5 4 4 3 6 35 2 13 7 32 3 5 4 4 423 3 3 6 4 5 5 6 5 3 I want to arrange all the data in

Re: [R] Optimizing variables represented in a matrix

2012-05-31 Thread nataraj
Thanks David and rest of people for replying to my problem posted here. Basically this is my attempt to estimate the variables of a Gaussian random field model using maximum likelihood method. I have examples of using "optim " command to optimize one or more variables in a function, the optim co

[R] Question on meaning of '%+%', '%?%' (? = various single letter) in code

2012-05-31 Thread Mike Hilt
Hello. I’ve seen several uses of '%?%' in R code (with ? = a single letter or other characters used as the middle character in a 3 character string with '%' as the 1st and 3rd characters). I’ve also recently seen ‘%+%’ usage at: http://vita.had.co.nz/papers/ggplot2-wires.pdf on p. 7 of the docu

Re: [R] Probably a good use for apply

2012-05-31 Thread ROLL Josh F
Yes you are correct. I want need to change my sample number specification to the number of elements in the vector. So sampleWorker function should be: sampleWorker <- function(x) return(sample(c(TRUE,FALSE),length(x), replace = TRUE, prob = c(x, 1-x))) So this is where I get a little confus

Re: [R] Higher log-likelihood in null vs. fitted model

2012-05-31 Thread Brian S Cade
Had several instances of similar issues with weighted leasts squares and weighted logistic regression recently. It is important to remember that the log likelihoods for the weighted models include a term that is a function of the n weights and that these are not incorporated in deviances (or s

Re: [R] Repost: Expressions returned by GlobalEnv functions and package functions

2012-05-31 Thread Oliver Ruebenacker
Hello Saptarshi, If two functions behave differently even though their definitions are identical, then it is because they refer to variables that were in scope when the functions were defined (i.e. lexical scoping). To prevent such differences, either define both functions in the same scope

Re: [R] Silencing the output of install.packages()

2012-05-31 Thread Tejas Kale
Dear Uwe Many thanks for your reply. I agree with you but I need the silencing of output for a particular reason. I am working on a statistical package called VOStat which uses a Java based GUI to get the data and parameters of the test to be executed from the user, creates the appropriate R scr

Re: [R] Using RDF/OWL with R?

2012-05-31 Thread J Toll
On Thu, May 31, 2012 at 6:40 AM, Oliver Ruebenacker wrote: >     Hello, > >  Is there a convenient way to import RDF/OWL data into R? > >  I'm interested in importing BioPAX/SBPAX data into R to make them > available for a wider audience. One exciting application would be to > use pathway data to

Re: [R] Probably a good use for apply

2012-05-31 Thread Sarah Goslee
Nope, you're misunderstanding lapply(). It will use your function on each element of the Iist, so on each vector of length 2. You need to write your function so that it will give the results you want with sampleWorker(test[[1]]) before it will work with lappy. Sarah On Thursday, May 31, 2012, RO

Re: [R] Transform counts into presence/absence

2012-05-31 Thread Rui Barradas
Hello, Actually, your output is wrong, you have compared the elements of a 'x', not Counts, to 0. > Counts <- c(1,0,21,2,0,0,234,2,0,NA) > Counts > 0 [1] TRUE FALSE TRUE TRUE FALSE FALSE TRUE TRUE FALSENA > 1 *(Counts > 0) [1] 1 0 1 1 0 0 1 1 0 NA > as.integer(Counts != 0)

Re: [R] community finding in a graph and heatplot

2012-05-31 Thread Aziz, Muhammad Fayez
Thank you so much Gabor for taking this on. Please find attached a sample scenario with the problem of malfunctioning dendogram by fgc. I hope this helps you narrow down to the solution. Best, Fayez From: csardi.ga...@gmail.com [csardi.ga...@gmail.com]

Re: [R] fitting allometric equation using a for a power model

2012-05-31 Thread Benjamin Caldwell
Yes! Thank you. * * *Ben Caldwell* On Thu, May 31, 2012 at 4:03 PM, peter dalgaard wrote: > > On Jun 1, 2012, at 00:14 , Benjamin Caldwell wrote: > > > temppow<-lm(log(y)~log(x)) > > plot(log(y)~log(x)) > > plot(residuals(temppow), main="pow") > > abline(temppow) > > plot(y~x, main="pow") > >

Re: [R] Wilcoxon-Mann-Whitney U value: outcomes from different stat packages

2012-05-31 Thread Ted Harding
On 30-May-2012 07:33:12 peter dalgaard wrote: > > On May 29, 2012, at 17:55 , maxbre wrote: >> Given this example >> [snip] >> And given the fact that: >> >> - in the note of R Wilcox.test is clearly stated: "The literature >> is not unanimous about the definitions of the Wilcoxon rank sum >> and

Re: [R] fitting allometric equation using a for a power model

2012-05-31 Thread peter dalgaard
On Jun 1, 2012, at 00:14 , Benjamin Caldwell wrote: > temppow<-lm(log(y)~log(x)) > plot(log(y)~log(x)) > plot(residuals(temppow), main="pow") > abline(temppow) > plot(y~x, main="pow") > tempsum<-summary(temppow)$adj.r.squared > tempint<-summary(temppow)$coefficients[1,1] #intercept of power funct

Re: [R] Transform counts into presence/absence

2012-05-31 Thread Duncan Mackay
Hi I was curious on the possibilities -- what if an NA creeps in? Counts <- c(1,0,21,2,0,0,234,2,0,NA) Counts > 0 1 *(Counts > 0) [1] 1 0 1 1 0 0 1 1 0 NA as.integer(x != 0) [1] 1 0 1 1 0 0 1 1 0 Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Duncan Murdoch > Sent: Thursday, May 31, 2012 3:27 PM > To: Bert Jacobs > Cc: r-help@r-project.org > Subject: Re: [R] RScript.exe and map directory issue > > On 12-05-31 4:40 PM,

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread csrabak
Em 31/5/2012 17:40, Bert Jacobs escreveu: Hi, I'm trying to run on Windows 7 a scriptfile with Rscript.exe from within Excel 2010 with the following code: Call Shell(rPath& "\Rscript.exe C:\Work\Latest\_Test.R", vbHide) The good news is: the above code works perfectly, but ... If I add white s

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread Duncan Murdoch
On 12-05-31 4:40 PM, Bert Jacobs wrote: Hi, I'm trying to run on Windows 7 a scriptfile with Rscript.exe from within Excel 2010 with the following code: Call Shell(rPath& "\Rscript.exe C:\Work\Latest\_Test.R", vbHide) The good news is: the above code works perfectly, but ... If I add white spa

[R] function to calculate a SMAPE (Symmetric mean absolute percentage error) to avoid the possibility of an inflation caused by zero values in the series

2012-05-31 Thread gianni lavaredo
Dear Reseacher, i find this modified version of SMAPE at pag 13 formula "msSMAPE" to to avoid the possibility of an inflation caused by zero values in the series using a Si component in the denominator of the symmetric MAPE http://www.stat.iastate.edu/preprint/articles/2004-10.pdf I wrote a f

[R] fitting allometric equation using a for a power model

2012-05-31 Thread Benjamin Caldwell
Hello all, I'm fitting an allometric equation that looks like a really clean fit in the log-log space, but when I back transform the fit of the curve appears to need an adjustment - the fitted curve appears to predict values a good deal higher than those from the data. I included a bias correction

Re: [R] one more piece of info on AIC

2012-05-31 Thread Rolf Turner
On 01/06/12 02:52, Mark Leeds wrote: just one other thing about the AIC issue: there is a line in glm.fit which is the following: aic = aic(y, n, mu, weights, dev) + 2 * rank but I couldn't find the function aic so I couldn't investigate further. It looks suspicious though because it seems to

Re: [R] Higher log-likelihood in null vs. fitted model

2012-05-31 Thread Andrew Miles
Interesting. If you use the deviances printed out by the fitted model (including the null deviance) and back-engineer it to log-likelihoods, you get results identical to Stata. > m$deviance*(-.5) [1] -390.9304 > m$null.deviance*(-.5) [1] -393.064 However, using the deviance to calculate the AI

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of R. Michael Weylandt > Sent: Thursday, May 31, 2012 2:51 PM > To: Bert Jacobs > Cc: r-help@r-project.org > Subject: Re: [R] RScript.exe and map directory issue > > Not on Windows

Re: [R] bigglm binomial negative fitted value

2012-05-31 Thread Yue Guan
Thank you very much. I do overlook something. On Thu, May 31, 2012 at 5:20 PM, Thomas Lumley wrote: > On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan wrote: >> Hi, there >> >> Since glm cannot handle factors very well. I try to use bigglm like this: >> >> logit_model <- bigglm(responser~var1+var2+v

Re: [R] print.data.frame to string?

2012-05-31 Thread ivo welch
great. thanks. exactly what I wanted. /iaw Ivo Welch (ivo.we...@gmail.com) On Thu, May 31, 2012 at 2:53 PM, David L Carlson wrote: > a <- data.frame(x=runif(4), y=runif(4), z=runif(4)) > b <- capture.output(a) > c <- paste(b, "\n", sep="") > cat("Your data set is:\n", c, "\n") >

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread Bert Jacobs
Thx Michael, After some testing (with more luck then craftmanship) it appears that following code works: Call Shell(rPath & "\Rscript.exe " & """C:\Work\Latest 1\_Test.R""", vbHide) I'll also try your solution. SY, Bert -Original Message- From: R. Michael Weylandt [mailto:michael.weyla..

Re: [R] print.data.frame to string?

2012-05-31 Thread David L Carlson
It will work if you paste a "\n" to the end of each line: a <- data.frame(x=runif(4), y=runif(4), z=runif(4)) b <- capture.output(a) c <- paste(b, "\n", sep="") cat("Your data set is:\n", c, "\n") -- David L Carlson Associate Professor of Anthropology T

Re: [R] RScript.exe and map directory issue

2012-05-31 Thread R. Michael Weylandt
Not on Windows so I can't test, but I imagine you need to escape the space: try this: Call Shell(rPath & "\Rscript.exe C:\Work\Latest\ 1\_Test.R", vbHide) Michael On Thu, May 31, 2012 at 4:40 PM, Bert Jacobs wrote: > Hi, > I'm trying to run on Windows 7 a scriptfile with Rscript.exe from within

Re: [R] svychisq??

2012-05-31 Thread Thomas Lumley
On Fri, Jun 1, 2012 at 6:07 AM, Diana Marcela Martinez Ruiz wrote: > > Hello forum, > > > I > want to do a test of independence > with svychisq, but I > get an error, then this my code: > > am18 <-   read.spss("C:/Users/diana/Dropbox/Semestre > 10/Tesis 10/Tesis Diana/AMcomuna18-29MAR2012.sav", >

[R] Repost: Expressions returned by GlobalEnv functions and package functions

2012-05-31 Thread Saptarshi Guha
Hello, (Sorry for the repost, i am resending in plain text) I have a function 'ewrap' (see below for definition). It takes 3 expressions and returns another expression e.g. map <- ewrap({ len <- length(r$addon) rhcollect(len,1) }) becomes: expression({ NULL result <- mapply(fu

Re: [R] community finding in a graph and heatplot

2012-05-31 Thread Gábor Csárdi
On Thu, May 31, 2012 at 12:08 PM, Aziz, Muhammad Fayez wrote: > > Thank you so much Gabor for your reply. I had spotted your post earlier and > it worked like a charm. Interestingly I have just ran into a trouble with the > stament dend <- igraph:::as.dendrogram.igraph.walktrap(fc). Apparently t

Re: [R] bigglm binomial negative fitted value

2012-05-31 Thread Thomas Lumley
On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan wrote: > Hi, there > > Since glm cannot handle factors very well. I try to use bigglm like this: > > logit_model <- bigglm(responser~var1+var2+var3, data, chunksize=1000, > family=binomial(), weights=~trial, sandwich=FALSE) > > fitted <- predict(logit_model

[R] Expressions returned by a Package function

2012-05-31 Thread Saptarshi Guha
Hello, I have a function 'ewrap' (see below for definition). It takes 3 expressions and returns another expression e.g. map <- ewrap({ len <- length(r$addon) rhcollect(len,1) }) becomes: expression({ NULL result <- mapply(function(.index, k, r) { { len <- l

Re: [R] Quadrat counting with spatstat

2012-05-31 Thread Petr Savicky
On Thu, May 31, 2012 at 08:23:02AM -0700, AMFTom wrote: > I have photographs of plots that look like so: > > http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg > > I need to divide it up so each circle has an equal area surrounding it. So > into 20 equal segments, each of which contains a

[R] RScript.exe and map directory issue

2012-05-31 Thread Bert Jacobs
Hi, I'm trying to run on Windows 7 a scriptfile with Rscript.exe from within Excel 2010 with the following code: Call Shell(rPath & "\Rscript.exe C:\Work\Latest\_Test.R", vbHide) The good news is: the above code works perfectly, but ... If I add white spaces to my map directory, like: Call Shell(

Re: [R] Probably a good use for apply

2012-05-31 Thread Sarah Goslee
Hi, On Thu, May 31, 2012 at 1:08 PM, LCOG1 wrote: > This is great thank you.  I think I am getting the hang of some of the apply > functions.  I am stuck again however.  I have list test_ below and would > like to apply the sample function using each element of each vector as the > probability an

Re: [R] print.data.frame to string?

2012-05-31 Thread ivo welch
thanks, jeff. no, not capture.output(), but thanks for pointing me to it (I did not know it). capture.output flattens the data frame. I want the print.data.frame output, so that I can feed it to cat, and get reasonable newlines, too. regards, /iaw Ivo Welch (ivo.we...@gmail.com) J. Fred W

[R] splines and ns equation

2012-05-31 Thread Ranae
Hi, I am looking at the change in N concentration in plant roots over 4 time points and I have fit a spline to the data using ns and lme: fit10 <- lme( N~ns(day, 3), data = rcn10G) I may want to adjust the model a little bit, but for now, let's assume it's good. I get output for the fixed effec

Re: [R] Quadrat counting with spatstat

2012-05-31 Thread Oliver Ruebenacker
Hello, There is more than one way to do it. I would divide space according to weighted distance. Specify a distance function. Euclidian distance will give you boundaries that consist of ellipse segments. Manhattan distance will give you straight lines which may be preferable. Assign t

[R] time-series statistics collection

2012-05-31 Thread Pierre Antoine DuBoDeNa
Hello, I am trying to collect several global measures or statistics for time-series as well as packages of R that can compute them. I have found several of them in papers and books, but the literature is so big i am sure i am missing several of them. skewness kurtosis min max mean SD trend season

Re: [R] How to aggregate combinations

2012-05-31 Thread Oritteropus
Thanks a lot, this is what I was looking for. All the best -- View this message in context: http://r.789695.n4.nabble.com/How-to-aggregate-combinations-tp4631867p4631980.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

[R] Prediction of the lme part of a gamm model estimated with mgcv

2012-05-31 Thread niandra
Dear useRs, I'm using the mgcv package for estimate a model with a smooth effect and a spatial covarianza matrix. I use the command predict(model$lme) to obtain a prediction with the fixed and random part of the model, but i need this kind of prevision also on a grid with different points than t

Re: [R] Probably a good use for apply

2012-05-31 Thread LCOG1
This is great thank you. I think I am getting the hang of some of the apply functions. I am stuck again however. I have list test_ below and would like to apply the sample function using each element of each vector as the probability and return a TRUE or FALSE that I will ultimately sum the TRUE

Re: [R] svychisq??

2012-05-31 Thread Diana Marcela Martinez Ruiz
Hello forum, I want to do a test of independence with svychisq, but I get an error, then this my code: am18 <- read.spss("C:/Users/diana/Dropbox/Semestre 10/Tesis 10/Tesis Diana/AMcomuna18-29MAR2012.sav", use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE) b<-matrix(c(am

Re: [R] print.data.frame to string?

2012-05-31 Thread Jeff Newmiller
capture.output(print(mydf)) note that df is a base function... best to not use it as a variable. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] print.data.frame to string?

2012-05-31 Thread Greg Snow
What do you mean by prints? You can use capture.output to get what would regularly be printed to the screen into a text vector, or use dput to get a version of an object that could be read back into another R session. On Thu, May 31, 2012 at 2:10 PM, ivo welch wrote: > dear R experts---is there

[R] print.data.frame to string?

2012-05-31 Thread ivo welch
dear R experts---is there a function that prints a data frame to a string? cat() cannot handle lists, so I cannot write cat("your data frame is:\n", df, "\n"). regards, /iaw Ivo Welch (ivo.we...@gmail.com) [[alternative HTML version deleted]] ___

Re: [R] Quadrat counting with spatstat

2012-05-31 Thread Clint Bowman
1. Erect a solid, impremeable wall around the perimeter. 2. Put a very flexible, membrane around each circle. 3. Add a drop of low viscosity, low surface tension liquid to each circle. 4. At some point, all circles will have expanded to completely fill the space. 5. The membranes will

Re: [R] Quadrat counting with spatstat

2012-05-31 Thread David Winsemius
On May 31, 2012, at 2:26 PM, R. Michael Weylandt wrote: On Thu, May 31, 2012 at 11:23 AM, AMFTom wrote: I have photographs of plots that look like so: http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg I need to divide it up so each circle has an equal area surrounding it. So into

Re: [R] Quadrat counting with spatstat

2012-05-31 Thread R. Michael Weylandt
On Thu, May 31, 2012 at 11:23 AM, AMFTom wrote: > I have photographs of plots that look like so: > > http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg > > I need to divide it up so each circle has an equal area surrounding it. So > into 20 equal segments, each of which contains a circle. Qu

Re: [R] density plots using density.lf, data.frame and sort.int errors

2012-05-31 Thread R. Michael Weylandt
My guess (unconfirmed) is that read.table() gives you a data frame but density.lf expects an atomic (= not a list = not a data frame) vector. Perhaps try density.lf(x[,1]) to just send the column -- the "drop" behavior should make sure this is an atomic vector. If that doesn't help, please do prov

Re: [R] How can I get this function to work?

2012-05-31 Thread Bert Gunter
I should have added, though: If you are writing R code you **must** learn to use R's debugging tools, which include: ?traceback ?debugger ?browser ?trace ?debug ?recover Then you do your own debugging instead of posting opaque code here and hoping that someone takes the bait. See the section on

[R] Incorporate a shapefile with an package animation

2012-05-31 Thread Steve_Friedman
Hello I'm working with NetCDF files in an animation and am trying to superimpose a shapefile on the image as it is generates the html pages. If I take out the lines for the shapefile, it works correctly, however I'm having difficultly including the shapefile. If anyone has any ideas I would gre

Re: [R] How can I get this function to work?

2012-05-31 Thread Sarah Goslee
On Thu, May 31, 2012 at 1:54 PM, Bert Gunter wrote: > Well, good luck finding someone to wade through your code -- > "small,reproducible" examples are requested for a reason -- but I will > offer that I have no idea what you mean with your remark about > anonymous functions, as the code you posted

Re: [R] How can I get this function to work?

2012-05-31 Thread Bert Gunter
Well, good luck finding someone to wade through your code -- "small,reproducible" examples are requested for a reason -- but I will offer that I have no idea what you mean with your remark about anonymous functions, as the code you posted has none. -- Bert On Thu, May 31, 2012 at 10:38 AM, Paul M

[R] How can I get this function to work?

2012-05-31 Thread Paul Miller
Hello All, Can anyone tell help me understand why the function below doesn't work and how I can fix it? Below are some sample data, some code that works on individual rows of the data, and my attempt to translate that code into a function. My hope is to get the function working and then to appl

Re: [R] problem with ifelse

2012-05-31 Thread Sarah Goslee
Hi, On Thu, May 31, 2012 at 12:49 PM, Christopher Kelvin wrote: > Hello, > Sorry for reply you directly but i feel that if i send to R they might not > post because they may not understand what i am trying to say > I want to provide you with the code below by using the survival package, that >

Re: [R] Optimizing variables represented in a matrix

2012-05-31 Thread Bert Gunter
Inline ... On Thu, May 31, 2012 at 9:09 AM, Kjetil Halvorsen wrote: > If you want an helpful answer, you must describe your real problem > MUCH    better! This is way too confused. Absolutely! -- But we certainly can say: > > Kjetil > > On Thu, May 31, 2012 at 7:37 AM,   wrote: >> >> Dear R-list

Re: [R] anova of lme objects (model1, model2) gives different results depending on order of models

2012-05-31 Thread Albyn Jones
No, both yield the same result: reject the null hypothesis, which always corresponds to the restricted (smaller) model. albyn On Thu, May 31, 2012 at 12:47:30PM +0100, Chris Beeley wrote: > Hello- > > I understand that it's convention, when comparing two models using > the anova function anova(m

[R] density plots using density.lf, data.frame and sort.int errors

2012-05-31 Thread Andrea S Sequeira
Dear R help group: I am attempting to produce a density plot from a list of 2 values using the density.lf function and would appreciate any help, I hope I have done my homework reading the documentation but I still seem to be missing something basic. I have read the data as a table using read.

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread arun
HI, I tweaked the code of James a little bit to produce the same result. > for(i in seq(ncol(df),1))  if(sd(df[,i])==0){  df[,i] <-NULL  } - Original Message - From: J Toll To: Johannes Radinger Cc: R-help@r-project.org Sent: Thursday, May 31, 2012 9:52 AM Subject: Re: [R] Remove co

[R] Forecast

2012-05-31 Thread 1stone
#- USDEUR.xts<-xts(USDEUR[,2:3], # columns with data USDEUR$Date) # column with date/time index USDEUR_sample.xts<-window(USDEUR.xts,end=as.Date("2012-03-25")) nobs<-length(USDEUR_

[R] Quadrat counting with spatstat

2012-05-31 Thread AMFTom
I have photographs of plots that look like so: http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg I need to divide it up so each circle has an equal area surrounding it. So into 20 equal segments, each of which contains a circle. Quadratcount is not sufficient because if I divide it up int

Re: [R] please help! Extract the row to the new file by using if-statment

2012-05-31 Thread Rainer Schuermann
Not sure whether I understand your data and objectives well enough but here is what I would do: To make my life easier, I used x as a variable name. I'm not using attach(). You can extract your data with something like y <- x[x$wrfta>= 255 | x$wrfta<= 65 & x$wrfrain == 0, ] y <- y[!is.na(y[5]),]

Re: [R] Optimizing variables represented in a matrix

2012-05-31 Thread Kjetil Halvorsen
If you want an helpful answer, you must describe your real problem MUCHbetter! This is way too confused. Kjetil On Thu, May 31, 2012 at 7:37 AM, wrote: > > Dear R-list members, > > I have a matrix with non-numeric variables in it and I have to optimize the > variables of the matrix in a fo

Re: [R] community finding in a graph and heatplot

2012-05-31 Thread Aziz, Muhammad Fayez
Thank you so much Gabor for your reply. I had spotted your post earlier and it worked like a charm. Interestingly I have just ran into a trouble with the stament dend <- igraph:::as.dendrogram.igraph.walktrap(fc). Apparently the members are empty as when I print(dend) it says 'dendrogram' with

Re: [R] community finding in a graph and heatplot

2012-05-31 Thread Gábor Csárdi
On Tue, May 29, 2012 at 1:16 AM, Aziz, Muhammad Fayez wrote: > > Hi everyone, > > I am using the fastgreedy.community function to get the $merges matrix and > the $modularity vector. This serves my purpose of testing modularity of my > graph. But I am "greedy" to plot the heat map and dendrrogra

Re: [R] one more piece of info on AIC

2012-05-31 Thread Peter Ehlers
On 2012-05-31 07:52, Mark Leeds wrote: just one other thing about the AIC issue: there is a line in glm.fit which is the following: aic = aic(y, n, mu, weights, dev) + 2 * rank but I couldn't find the function aic so I couldn't investigate further. It looks suspicious though because it seems t

Re: [R] problem with ifelse

2012-05-31 Thread Sarah Goslee
Hi, On Thu, May 31, 2012 at 10:09 AM, Christopher Kelvin wrote: > Hello Sarah, >  I hope i have understood you; All i seek to do is to get a code that i can > obtain interval censoring from without using the survival package. Can you > come to my aid? Probably, but you need to meet me halfway.

[R] please help! Extract the row to the new file by using if-statment

2012-05-31 Thread pigpigmeow
Dear all, I find some troubles about how to extact the row from csv. file by using if-statement condition. I want to extract the row if the rainfall is greater than the mean of rainfall and using the wrfta divided into 3 groups that's rainfall greater than mean -> group A ( create file group A_rai

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread Jorge I Velez
Hi Johannes, Here are two approaches to accomplish this: subset(df, select = -B) df[, colnames(df) != "B"] HTH, Jorge.- On Thu, May 31, 2012 at 10:34 AM, Johannes Radinger <> wrote: > Hi James > Hi Jorge, > > Thank you very much! > I like the apply-approach, it seems really quite > simple and

[R] one more piece of info on AIC

2012-05-31 Thread Mark Leeds
just one other thing about the AIC issue: there is a line in glm.fit which is the following: aic = aic(y, n, mu, weights, dev) + 2 * rank but I couldn't find the function aic so I couldn't investigate further. It looks suspicious though because it seems to me like it should be aic = -2*likelih

Re: [R] Optimizing variables represented in a matrix

2012-05-31 Thread David Winsemius
On May 31, 2012, at 7:37 AM, > wrote: Dear R-list members, I have a matrix with non-numeric variables in it and I have to optimize the variables of the matrix in a formula using optim routine of the stats4 package. I know the matrix can only take numeric data Some of the things you

[R] counting the data in different groups for each row

2012-05-31 Thread ramakanth reddy
Dear R, I have data like this I I D I D D D D D I D I D I D I D I D D D I D D I I I I I I I I D I D I D I I I D I I I D I D I D I D I 0 0 I I I I I I I I I D I D I D I D I I I D I I I D I D I D I D I I I D I I I I I Now for each row i want to make count in groups 2 in each group for all possible

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread Johannes Radinger
Hi James Hi Jorge, Thank you very much! I like the apply-approach, it seems really quite simple and I get back the TRUE-FALSE vector which I can use for indexing the dataframe. Now there popped the questions if one can implement any "exeption", like do the selection of the columns exept for column

Re: [R] Silencing the output of install.packages()

2012-05-31 Thread Uwe Ligges
On 31.05.2012 16:18, Tejas Kale wrote: Hello! Is there a way to suppress the output of 'install.packages()'? I have seen that the 'download.file' function has a 'quiet' option but I do not know how to use it. I do not see any good reason to allow that. A user shoudl see if software is being i

Re: [R] reading file in zip archive

2012-05-31 Thread David Winsemius
On May 31, 2012, at 6:11 AM, Iain Gallagher wrote: Hi Phil That's it. Thanks. Will have a read at the docs now and see if I can figure out why leaving the 'r'ead instruction out works. Seems counter-intuitive! It says that unz uses binary mode. You were specifying text mode. See if open

Re: [R] cluster with mahalanobis distance

2012-05-31 Thread David L Carlson
Use distance() in package ecodist to compute the mahalanobis distance matrix and pass that to hclust(). -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-he

Re: [R] odfWeave fails to load

2012-05-31 Thread Uwe Ligges
On 31.05.2012 15:59, Bond, Stephen wrote: Uwe, Just a user's perspective: there are too many packages that work only on the maintainer's box and it would benefit the community if there were stricter standards for allowing people to post a package. Open systems like Ubuntu have a ratings syt

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread J Toll
On Thu, May 31, 2012 at 8:52 AM, J Toll wrote: > for (i in seq(ncol(df), 1)) >  if (length(unique(df[, i])) == 1) { >  df[, i] <- NULL > } Here's a similar method employing a more functional approach: df[, apply(df, 2, function(x) length(unique(x)) > 1)] James ___

[R] Silencing the output of install.packages()

2012-05-31 Thread Tejas Kale
Hello! Is there a way to suppress the output of 'install.packages()'? I have seen that the 'download.file' function has a 'quiet' option but I do not know how to use it. Thanks for your help Tejas Kale IUCAA, Pune __ R-help@r-project.org mailing list

Re: [R] Automated essay scoring by R

2012-05-31 Thread David L Carlson
Look at "CRAN Task View: Natural Language Processing" http://cran.r-project.org/web/views/NaturalLanguageProcessing.html You may be talking about package lsa which is described in the Task View along with a link to an article, "Investigating Unstructured Texts with Latent Semantic Analysis." The

[R] bigglm binomial negative fitted value

2012-05-31 Thread Yue Guan
Hi, there Since glm cannot handle factors very well. I try to use bigglm like this: logit_model <- bigglm(responser~var1+var2+var3, data, chunksize=1000, family=binomial(), weights=~trial, sandwich=FALSE) fitted <- predict(logit_model, data) only var2 is factor, var1 and var3 are numeric. I ex

Re: [R] gsub/strsplit with multiple patterns/splits

2012-05-31 Thread mdvaan
Thank you very much. This definitely helps me out. Math Jeff Newmiller wrote > > There are many resources for learning regular expressions (e.g. > http://gnosis.cx/publish/programming/regular_expressions.html). Once you > understand the basics you will probably be able to refer to the ?regex >

Re: [R] odfWeave fails to load

2012-05-31 Thread Bond, Stephen
Uwe, Just a user's perspective: there are too many packages that work only on the maintainer's box and it would benefit the community if there were stricter standards for allowing people to post a package. Open systems like Ubuntu have a ratings sytem that allows users to review packages, so t

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread Jorge I Velez
Hi Johannes, Try df[, !apply(df, 2, function(x) sd(x, na.rm = TRUE) < 1e-10)] HTH, Jorge.- On Thu, May 31, 2012 at 9:27 AM, Johannes Radinger <> wrote: > Hi, > > I have a dataframe and want to remove columns from it > that are populated with a similar value (for the total > column) (the varia

Re: [R] Higher log-likelihood in null vs. fitted model

2012-05-31 Thread Mark Leeds
Hi Duncan: I don't know if the following can help but I checked the code and logLik defines the log likelihood as (p - glmobject$aic/2) where p is the glmobject$rank. So, the reason for the likelihood being less is that, in the null, it ends up being ( 1 - glmobject$aic/2) and in the other one i

Re: [R] Remove columns from dataframe based on their statistics

2012-05-31 Thread J Toll
On Thu, May 31, 2012 at 8:27 AM, Johannes Radinger wrote: > Hi, > > I have a dataframe and want to remove columns from it > that are populated with a similar value (for the total > column) (the variation of that column is 0). Is there an > easier way than to calculate the statistics and then > rem

Re: [R] How to create a floating bar plot

2012-05-31 Thread Richard M. Heiberger
Please look at the likert function in the HH package. ?likert has many examples. Here is the code for your query ## install.packages("HH") ## if necessary library(HH) twobar <- data.frame(neg=c(8,0,9,2), pos=c(12,9,0,4)) likert(twobar) Rich On Thu, May 31, 2012 at 9:30 AM, Sarah Goslee wrote: >

Re: [R] inverse binomial in R

2012-05-31 Thread Duncan Murdoch
On 12-05-31 9:10 AM, anna freni sterrantino wrote: Hello! I'm having some trouble trying to replicate in R a Stata function invbinomial(n,k,p) Domain n: 1 to 1e+17 Domain k: 0 to n - 1 Domain p: 0 to 1 (exclusive) Range:0 to 1 Descrip

Re: [R] How to create a floating bar plot

2012-05-31 Thread Sarah Goslee
Hi Roberto, The R Graph Gallery is an excellent resource for this kind of question. You can browse the thumbnails until you find something that leads you in the right direction, like maybe: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=136 Sarah On Thu, May 31, 2012 at 7:18 AM,

[R] Remove columns from dataframe based on their statistics

2012-05-31 Thread Johannes Radinger
Hi, I have a dataframe and want to remove columns from it that are populated with a similar value (for the total column) (the variation of that column is 0). Is there an easier way than to calculate the statistics and then remove them by hand? A <- runif(100) B <- rep(1,100) C <- rep(2.42,100) D

Re: [R] Higher log-likelihood in null vs. fitted model

2012-05-31 Thread Duncan Murdoch
On 12-05-31 8:53 AM, Andrew Miles wrote: Two related questions. First, I am fitting a model with a single predictor, and then a null model with only the intercept. In theory, the fitted model should have a higher log-likelihood than the null model, but that does not happen. See the output belo

[R] inverse binomial in R

2012-05-31 Thread anna freni sterrantino
Hello! I'm having some trouble  trying to replicate in R a Stata function  invbinomial(n,k,p)        Domain n:     1 to 1e+17        Domain k:     0 to n - 1        Domain p:     0 to 1 (exclusive)        Range:        0 to 1        Description:  returns the inverse of the cumulative binomial; i.e

  1   2   >