Re: [R] Count number of rain more than zero in matrix form

2015-09-30 Thread PIKAL Petr
Hi Great that you used dput, bad that you send HTML email which somehow scrambled it. 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L Error: un

[R] Count number of rain more than zero in matrix form

2015-09-30 Thread smart hendsome
Hello R-users, I want to ask how to count the number of daily rain data.  My data using dput() as below: structure(list(Year = c(1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L, 1960L,

[R] [R-pkgs] Major updates to Hmisc and rms packages

2015-09-30 Thread Frank Harrell
New versions of Hmisc and rms are available on CRAN. Changes are listed below. The most significant change to Hmisc is the addition of the ffCompress function that creates an optimal ff package object for large data frames by computing the maximum number of bits used by each numeric or logical

Re: [R] [FORGED] cumulative distribtuion function for multinomial distribution in R

2015-09-30 Thread Rolf Turner
On 30/09/15 20:55, peter dalgaard wrote: I know exactly this: https://cran.r-project.org/web/packages/MFSAS/index.html As I understand things (but I am not a CRAN maintainer): This is compatible with a situation where the maintainer exists but doesn't update the package. I think a package only

[R] R help - "UCL at different levels"

2015-09-30 Thread Syed Abrar Ahmed
Hello Experts, I need your help to understand the how can we calculate the UCL values at different levels dynamically? Customer No Month Sales UCL 100 201501 500 550.75 100 201502 100 550.75 101 201501 400 425.25 101 201502 50 425.25 In the above scenario i need calculate UCL

Re: [R] optimizing with non-linear constraints

2015-09-30 Thread Ravi Varadhan
Hi Rainer, It is very simple to specify the constraints (linear or nonlinear) in "alabama" . They are specified in a function called `hin', where the constraints are written such that they are positive. Your two nonlinear constraints would be written as follows: hin <- function(x, LAI) { h <-

Re: [R] na.action in xtabs - how to include NAs?

2015-09-30 Thread David L Carlson
If you are going to do this routinely or with many factors, you can build NA into each of the factors, but that will affect other operations: > xNA <- lapply(x, factor, exclude=NULL) > xtabs(~a+b, xNA) b a 2 3 4 10 0 01 21 0 00 30 1 00 0 0 10

Re: [R] (subscript) logical subscript too long

2015-09-30 Thread Giorgio Garziano
Be: log <- (rowSums(ED) <= (n - m)) Compare the following two values: length(log) nrow(w) -- GG [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/ma

[R] (subscript) logical subscript too long

2015-09-30 Thread Maram SAlem
Dear All, I'm trying to write a function in the values of some numeric vectors (d1,d2,...,d(m-1)). This function should be applied on some combinations of the elements of the (m-1) d vectors that satisfy the condition of having a sum less than or equal to (n-m). I've tried the following code, but

Re: [R] na.action in xtabs - how to include NAs?

2015-09-30 Thread Dimitri Liakhovitski
Thank you very much, Bill - it worked. Wow, that's very wordy! On Wed, Sep 30, 2015 at 11:09 AM, William Dunlap wrote: > Try both na.action=na.pass and exclude=NULL, the first is for > xtabs' call to model.frame and the second for when it prepares > the data from model.frame's output for a call t

Re: [R] na.action in xtabs - how to include NAs?

2015-09-30 Thread William Dunlap
Try both na.action=na.pass and exclude=NULL, the first is for xtabs' call to model.frame and the second for when it prepares the data from model.frame's output for a call to table. xtabs(formula = ~a + b, data = x, na.action = na.pass, exclude = NULL) Bill Dunlap TIBCO Software wdunlap tibco.com

[R] na.action in xtabs - how to include NAs?

2015-09-30 Thread Dimitri Liakhovitski
Please help: # I have a data frame x: x <- data.frame(a = c(1:3, NA), b = c(NA, 2:4)) # I run a cross-tab keeping NAs, like this: table(x[c("a", "b")], useNA = "ifany") # I want to reproduce it using xtabs, but it ignores NAs: xtabs(~ a + b, x) # I can't figure out how to force xtabs to include

Re: [R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Giorgio Garziano
The "pronoun dot" is used in conjunction with %>% in dplyr (which imports magrittr). See pag.9, paragraph "Placing lhs elsewhere in rhs call" of the document: https://cran.r-project.org/web/packages/magrittr/magrittr.pdf -- GG __ R-help@r-project.org

Re: [R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Dimitri Liakhovitski
Thank you very much, got it: It's because complete.cases is an R base command. On Wed, Sep 30, 2015 at 10:15 AM, Giorgio Garziano wrote: > This works: > > filter(mydata, complete.cases(mydata)) > > About dplyr "pronoun dot", see: > > http://www.r-bloggers.com/dplyr-0-2/ > > > -- > GG > > > > >

Re: [R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Giorgio Garziano
This works: filter(mydata, complete.cases(mydata)) About dplyr "pronoun dot", see: http://www.r-bloggers.com/dplyr-0-2/ -- GG [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

[R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Dimitri Liakhovitski
Hello! I don't have a data set, but my question is very clear without it. I have a data frame 'mydata' and want to reproduce in dplyr the following R base command: mydata[complete.cases(mydata), ] This dplyr command produces the expected result: library(dplyr) mydata %>% filter(complete.cases(.)

Re: [R] Theme white bands blue and grey or other color

2015-09-30 Thread Giorgio Garziano
library(quantmod) getSymbols("YHOO") chartSeries(YHOO, theme="white") b1 <- addBBands(50,2) b1@params$colors$bg.col="#FF" b1 b2 <- addBBands(100,2) b2@params$colors$bg.col="#FF" b2 [[alternative HTML version deleted]] _

Re: [R] Calculate Total CORRECTED SS for non linear regression

2015-09-30 Thread Jeff Newmiller
Michael... this is an example of a thread that is quickly headed off-topic for R-help because there are lots of resources for learning "why" one formula might be better than another elsewhere and the use of the R language is not central to that discussion (and yet this topic has been discussed b

Re: [R] External functions called by my functions

2015-09-30 Thread Giorgio Garziano
See if this may help: http://stackoverflow.com/questions/11872879/finding-out-which-functions-are-called-within-a-given-function -- GG [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] External functions called by my functions

2015-09-30 Thread Frederico Mestre
Hello, Is there any way to list all the functions called inside ​a given set of​ functions? Something like the function foodweb from mvbutils. ​ This function maps the relations between the functions of a package, but what I need is something to show me the relations with external functions. Th

Re: [R] Calculate Total CORRECTED SS for non linear regression

2015-09-30 Thread Michael Eisenring
Hi Peter, Thanks for your answer. I am still a bit confused- So that means that the calculation of the " R2" for my non-linear model is in fact the formula I used in my eample: CompoundSS <- sum((dta$Compound - mean(dta$Compound))^2) R2 <- deviance(dta.nls)/CompoundSS R2 What's then the differen

Re: [R] Calculate Total CORRECTED SS for non linear regression

2015-09-30 Thread ProfJCNash
Some workers consider it bad practise to compute what is called R-squared for a nonlinear model. I find it useful for nonlinear models as a signpost of how good a fit has been found. But just as signposts can be turned around by vandals, nonlinear models can give a misleading indication. With linea

[R] optimizing with non-linear constraints

2015-09-30 Thread Rainer M Krug
Hi I have posted the following question on stackoverflow [1] but haven't received a response yet. Has somebody here any idea, how to formulate non-linear constraints using e.g. the packages alabama or nlopr? The question is pasted below. I am really stuck with this. Thanks, Rainer , | I am

Re: [R] X Stacked bars of Y values, with bar segments colored according to Z

2015-09-30 Thread Jim Lemon
Hi Dale, This apparently simple plot turned out to be fairly messy. "barplot" doesn't seem to accept a matrix of colors, and "barp" doesn't yet do a stacked plot, so I can only suggest a fairly labor intensive one-off plot: barcol<-color.scale(x$mh,extremes=c("yellow","red")) barheights<-rowSums(x

Re: [R] Calculate Total CORRECTED SS for non linear regression

2015-09-30 Thread peter dalgaard
> On 30 Sep 2015, at 02:08 , Michael Eisenring wrote: > > Can anyone tell me how to calculate the Total Corrected SS in R and how it > can be implemented in my code? It is just sum((y-mean(y))^2). Beware that a fair amount of (somewhat silly) contention is going on in this area, though. In pa

Re: [R] [FORGED] cumulative distribtuion function for multinomial distribution in R

2015-09-30 Thread peter dalgaard
I know exactly this: https://cran.r-project.org/web/packages/MFSAS/index.html As I understand things (but I am not a CRAN maintainer): This is compatible with a situation where the maintainer exists but doesn't update the package. I think a package only gets to orphaned status if the maintainer