Re: [R] Retrieving lists of colnames

2014-10-15 Thread Vikash Kumar
Hi Adam, I guess below code would help you achieve the desired ouput. > colnames(data[,which(apply(data,2,FUN = function(x){any(x>0.5)}))]) Happy Learning! Vikash On Wed, Oct 15, 2014 at 5:53 PM, adam.n.jenkin...@gmail.com < adam.n.jenkin...@gmail.com> wrote: > > > Hi what I have is a large e

Re: [R] how to loop through dataframe objects in environment

2014-10-15 Thread Vikash Kumar
Hi Stephen, Try out lapply(). It would help you loop through all data frames and sum. Regards, Vikash On Thu, Oct 16, 2014 at 1:58 AM, Stephen HK Wong wrote: > Dear All, > > I have many 50 objects they are all dataframes. Each dataframe has many > rows and four column. I simply want to do an

Re: [R] HELP

2014-10-15 Thread PIKAL Petr
Hi It will be even worse with age, try to contact optician :-) If you want to get better answer you need to provide more info about your file, what you did and how it failed. Cheers Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org]

Re: [R] Retrieving lists of colnames

2014-10-15 Thread PIKAL Petr
Hi First of all you shall transfer your data to R. Maybe it can be solved by apply but in your case I would use for cycle Let say your data frame is named doc lll<-vector(nrow(doc), mode="list") for(i in 1:nrow(doc)) lll[[i]]<-colnames(doc)[(which(doc[i,]>0))] Cheers Petr > -Original Mess

Re: [R] Passing object value in command line

2014-10-15 Thread MacQueen, Don
Don¹t know exactly what you mean by ³passing the value of Mon from the command prompt², but it could be At the R prompt: > Mon <- ¹31-may-2014¹ > source(mainCall.R) If, on the other hand, you mean shell prompt, then within R see ?commandArgs On 10/15/14, 11:21 AM, "Abhinaba Roy" wrote: >Hi

[R] how to loop through dataframe objects in environment

2014-10-15 Thread Stephen HK Wong
Dear All, I have many 50 objects they are all dataframes. Each dataframe has many rows and four column. I simply want to do an addition of 3rd and 4th column and save the result into 5th column. Since there are many dataframes, I don't want to do it one by one, is there a way to loop through

Re: [R] Proportion data GAM

2014-10-15 Thread Rodrigo Tardin
Thanks Simon! That worked! I did not constrain my k as you suggested, but when I saw my results, my degrees of freedom are not larger than 1, the REML is negative and all covariates are not significant (what it does not make sense). Is there something wrong? Here's the results of summary (a2) Fa

Re: [R] Proportion data GAM

2014-10-15 Thread Rodrigo Tardin
Hi Simon, The result of sessionInfo() is: R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252 [3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C [5] LC_TIME=Portuguese_Brazil.1252 attached base pac

Re: [R] Proportion data GAM

2014-10-15 Thread Simon Wood
Rodrigo, OK, it looks as if your mgcv help files/manual are somehow out of sync with the package version you have loaded. 'betar' is only available from mgcv 1.8. If you update to the current mgcv from CRAN then this problem should be solved. best, Simon ps. beta regression is only availabl

Re: [R] Proportion data GAM

2014-10-15 Thread Simon Wood
Can you give the result of typing sessionInfo() in the session where this happens, please? On 15/10/14 16:48, Rodrigo Tardin wrote: Hi all, I am not sure if this is the right place for this question or if there is one more specific. Anyway, I hope somebody can help me. I am trying to run a GAM

Re: [R] Passing object value in command line

2014-10-15 Thread Jeff Newmiller
There is this great document called the R Reference that comes with the software in which you can search for "command" and find the answer. There is also a useful function called apropos that can search the help files from the R prompt. Try apropos("command"). There is also a manual for this ma

[R] HELP

2014-10-15 Thread JAVAD LESSAN
Hello There! I have an issue reading a large text file and parsing it. I would be grateful if you let me you can help me about? Thanks. Javad [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

[R] Retrieving lists of colnames

2014-10-15 Thread adam.n.jenkin...@gmail.com
Hi what I have is a large excel doc (100 columns, 350 row) with data values from 0-1. The end goal is for each row to have a list of colnames of which columns contain values >0. I've been tinkering around with apply mostly and some other functions, any help offered would be greatly appreci

[R] Proportion data GAM

2014-10-15 Thread Rodrigo Tardin
Hi all, I am not sure if this is the right place for this question or if there is one more specific. Anyway, I hope somebody can help me. I am trying to run a GAM with beta distribution from mgcv package. My dependent variable is a proportion continuously ranging from 0 to 1 (whales density) and

[R] Passing object value in command line

2014-10-15 Thread Abhinaba Roy
Hi R-helpers, I have a R script (mainCall.R) which takes the value of an object *'Mon'* as '31-may-2014' or '31-aug-2014' . How can I run the R script by passing the value of Mon from the command prompt? Any help will be appreciated Regards, Abhinaba [[alternative HTML version deleted]

Re: [R] Ternary Plots Do Not Display Ellipses in PDF

2014-10-15 Thread Rich Shepard
On Wed, 15 Oct 2014, David L Carlson wrote: I haven't looked at the source so I don't know exactly what is going on, but I think I have a work around: plot(winters.acomp, main="Winters Creek", cex=0.5) pdf("winters-pdf.pdf") ellipses(mean=mn, var=vr, r=r, steps=72, thinRatio=NULL, aspanel=FAL

Re: [R] package installation failure virtualisation environment

2014-10-15 Thread William Dunlap
Have you looked at recent entries in the system log files in /var/log, especially /var/log/kern.log? Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Oct 15, 2014 at 1:51 AM, wrote: > On 2014-10-14 15:40, Sven E. Templer wrote: >> >> Prevent graphic menues with: >> options(menu.graphics = F

Re: [R] Sum of two consecutive number in dataset.

2014-10-15 Thread Jeff Newmiller
twodays <- c(filter(x,c(1,1),sides=1)) might be more efficient with memory than the embed approach, which might be important if more than two days were of interest. --- Jeff NewmillerThe .

Re: [R] Sum of two consecutive number in dataset.

2014-10-15 Thread William Dunlap
Break down your problem into parts: # compute two-day totals. I use filter here, but there are many ways twoDayTotal <- function (x, init = 0) { # init lets you supply rainfall from day previous to first in x filter(c(init, x), c(1, 1))[-length(x)] } # compute the first time a logical vect

Re: [R] Ternary Plots Do Not Display Ellipses in PDF

2014-10-15 Thread Rich Shepard
On Wed, 15 Oct 2014, David L Carlson wrote: I haven't looked at the source so I don't know exactly what is going on, but I think I have a work around. While running your example I noticed that ellipse() does not just add the ellipse to the plot produced by plot(), it replots the figure. However,

Re: [R] Sum of two consecutive number in dataset.

2014-10-15 Thread Tom Wright
A couple of observations: 1) I'm not sure what the variable i is doing, looks like you are trying to loop through years but perhaps you left that bit of code out for clarity. 2) On the first loop of i you are assigning the values of Samaru56[sow_day,] to all values in Samaru56. For future loops all

Re: [R] Ternary Plots Do Not Display Ellipses in PDF

2014-10-15 Thread David L Carlson
I haven't looked at the source so I don't know exactly what is going on, but I think I have a work around. While running your example I noticed that ellipse() does not just add the ellipse to the plot produced by plot(), it replots the figure. However, just running ellipse() without plot() gener

Re: [R] vcov function and cross terms

2014-10-15 Thread Anthony Damico
it might be slightly different, but i think the result is very close to a tsl result (which hasn't been implemented).. could you use this? mns<-svyby(~api00+api99, ~stype, rclus1, svytotal,covmat=TRUE) vcov(mns) On Wed, Oct 15, 2014 at 9:27 AM, Daniela Droguett < daniela.droguett.l...@gmail.c

Re: [R] gsub regexp question

2014-10-15 Thread Jeff Newmiller
I believe the backslash is not considered an escape character by the extended RE library used by R (perl=FALSE), so it is being treated as a literal. This means that the last ] is outside the character class and is the atom that the * applies to. gsub("^([[:alnum:]\\[\\]]*).*", "\\1", "a]]]rra

[R] vcov function and cross terms

2014-10-15 Thread Daniela Droguett
Hi, I would like to apply the vcov function from the survey package for the variables api00 and api99 grouped by the stype variable which can assume H, M and E categories. ​From the code in the survey package manual:​ ​data(api) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) r

Re: [R] Sum of two consecutive number in dataset.

2014-10-15 Thread Franklin Mairura
Hi, this sound like u are calculating cummulative rainfall, this can also be done in excel, then import the matrix to R, hope can help, Franklin, Maseno, Kenya. On Wednesday, October 15, 2014 1:02 PM, PIKAL Petr wrote: Hi twodays <- rowSums(embed(Samaru56$Rain,2)) gives you sum of rain

[R] gsub regexp question

2014-10-15 Thread ALBERTO VIEIRA FERREIRA MONTEIRO
I just found a curious behaviour of regexp and I'd like to share with y'all. gsub("^([[:alnum:]\\[\\]]*).*", "\\1", "array[n] <- 10", perl=T) # works as expected ("array[n]") gsub("^([[:alnum:]\\[\\]]*).*", "\\1", "array[n] <- 10", perl=F) # doesn't work ("a") I didn't find anything in the docum

Re: [R] how to ajust y-axis values in plot() ?

2014-10-15 Thread PIKAL Petr
Hi is > plot(11:20, ylim=c(0,40)) > abline(h=40) > what you want? Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of PO SU > Sent: Tuesday, October 14, 2014 11:33 AM > To: R. Help > Subject: [R] how to ajust y-a

Re: [R] Sum of two consecutive number in dataset.

2014-10-15 Thread PIKAL Petr
Hi twodays <- rowSums(embed(Samaru56$Rain,2)) gives you sum of rain in 2 cosecutive days sel <- which(twodays>20) gives you vector of row numbers in which above condition results in TRUE value Samaru56[sel,] selects these rows Regards Petr > -Original Message- > From: r-help-boun...

Re: [R] lag operator on a zoo object - code sharing

2014-10-15 Thread Pascal Oettli
Hi, You probably missed the "na.pad" argument of the "lag" function (for zoo objects). ?zoo:::lag.zoo Regards, Pascal On Wed, Oct 15, 2014 at 6:00 PM, jpm miao wrote: > Hi, >I could not find a nice lag operator on zoo object. Perhaps there is, > but I just couldn't find it. Basically I want

Re: [R] lag operator on a zoo object - code sharing

2014-10-15 Thread Achim Zeileis
On Wed, 15 Oct 2014, jpm miao wrote: Hi, I could not find a nice lag operator on zoo object. Perhaps there is, but I just couldn't find it. See ?lag.zoo. Basically I want the operator to return the lagged zoo object (with one or more variables ) with the original date. For example, if I wr

Re: [R] package installation failure virtualisation environment

2014-10-15 Thread Sven E. Templer
did you check the connection in R via for example: head(readLines("http://cran.r-project.org/web/licenses/GPL-3";)) which should yield: [1] "GNU GENERAL PUBLIC LICENSE" [2] " Version 3, 29 June 2007" [3] "" [4] " Copyright (C) 2007 Free Software Foundati

[R] lag operator on a zoo object - code sharing

2014-10-15 Thread jpm miao
Hi, I could not find a nice lag operator on zoo object. Perhaps there is, but I just couldn't find it. Basically I want the operator to return the lagged zoo object (with one or more variables ) with the original date. For example, if I write lag(x, -3), then I got the lagged series, but the fir

Re: [R] package installation failure virtualisation environment

2014-10-15 Thread rl
On 2014-10-14 15:40, Sven E. Templer wrote: Prevent graphic menues with: options(menu.graphics = FALSE) Same response after a pause: 'Killed' or and define repositories: options(repos = c(CRAN = "http://cran.r-project.org";)) Same response after a pause: 'Killed' _

[R] Parameter estimation of loglogistic, lognormal and 2 parameter exponential distributions

2014-10-15 Thread Jomy Jose
How to estimate paremeters the of loglogistic,lognormal and 2 parameter exponential distributions in R using fitdistr function. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

[R] Sum of two consecutive number in dataset.

2014-10-15 Thread Frederic Ntirenganya
Dear All, i am solving the following problem in my work. The first day from April 01 that gets more than 20 mm on a single day, or totalled over 2 consecutive days. i.e April 01 = 92th day of the year. The column of interest is "Rain". > head(Samaru56) Year Day Rain 1 1928 10 2 1928 2