Re: [R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-27 Thread Jeff Newmiller
A function MUST return one object. That one object may consist of a list of objects, but you have to separate the parts out after the function call yourself. -- Sent from my phone. Please excuse my brevity. On July 27, 2017 10:54:08 PM PDT, Vijaya Kumar Regati wrote: >Hi, > > >Can someone pl

Re: [R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-27 Thread Berend Hasselman
> On 28 Jul 2017, at 07:54, Vijaya Kumar Regati > wrote: > > Hi, > > > Can someone please help me on below issue I am facing : > > > I am trying to play with returning a dataframe+2 variables using a fn. > But facing an issue : > > Error in Logic_fn(c(x, y)) : argument "y" is missing, with

[R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-27 Thread Vijaya Kumar Regati
Hi, Can someone please help me on below issue I am facing : I am trying to play with returning a dataframe+2 variables using a fn. But facing an issue : Error in Logic_fn(c(x, y)) : argument "y" is missing, with no default This is the code I am using : x <- 0 y <- 0 Logic_fn <- function(x,

Re: [R] [FORGED] Re: axis() after image.plot() does not work except if points() is inserted between

2017-07-27 Thread Paul Murrell
Hi I believe this is a clipping bug in the 'graphics' package. A simpler version of the problem is this ... plot(1:10) mtext("margin-label", side=2, at=9, las=1, line=1, adj=0) par(mfg=c(1,1)) ## Only the text within the plot region is drawn mtext("margin-label", side=2, at=9, las=1, line=1, ad

Re: [R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread peter dalgaard
It's ancient history, but the idiocy was to take a perfectly fine[*] standard file format and make it use locale dependent number formats, instead of just standardizing on the US format for data transfer purposes. -pd [*] OK, less than perfect, given quoting issues and various other stuff...

Re: [R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread Rui Barradas
Hello, Inline. Em 27-07-2017 20:36, peter dalgaard escreveu: On 27 Jul 2017, at 18:03 , Jeff Newmiller wrote: Looks like you need to pay attention to how you read in your data. In general, you should always execute one statement at a time until you know your script is working. All the e

Re: [R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread Jeff Newmiller
True, except that the head of their file had periods in the numbers. -- Sent from my phone. Please excuse my brevity. On July 27, 2017 12:36:13 PM PDT, peter dalgaard wrote: > >> On 27 Jul 2017, at 18:03 , Jeff Newmiller >wrote: >> >> Looks like you need to pay attention to how you read in yo

Re: [R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread peter dalgaard
> On 27 Jul 2017, at 18:03 , Jeff Newmiller wrote: > > Looks like you need to pay attention to how you read in your data. In > general, you should always execute one statement at a time until you know > your script is working. All the errors after the first one are unhelpful to > you or us.

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Important to notice: this seems to be an issue only with an unordered factor on the X axis. When the variable is numeric or an ordered factor, then it works as described in Help. On Thu, Jul 27, 2017 at 11:58 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Тhanks for the advic

Re: [R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread Jeff Newmiller
Looks like you need to pay attention to how you read in your data. In general, you should always execute one statement at a time until you know your script is working. All the errors after the first one are unhelpful to you or us. If you actually pay attention to what is in your horse.data da

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Тhanks for the advice, Jeff. Will keep it in mind. But I am anal - I shy away from using letters and words that "look familiar" to me in R (such as mean, sd, T, etc.) But still, it's a good advice. On Thu, Jul 27, 2017 at 11:53 AM, Jeff Newmiller wrote: > I think you should be more suspicious of

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Jeff Newmiller
I think you should be more suspicious of yourself, Dimitri. A letter T variable can easily arise in the problem domain when you are not thinking of logical values at all, at which point your cavalier use of T as a synonym for TRUE can suddenly become a bug. -- Sent from my phone. Please excuse

[R] Error in `[[<-.data.frame`(`*tmp*`, alt.name, value = integer(0)) with mlogit

2017-07-27 Thread sandoz
Hi, Please help about the error I am getting after the h1.dat<- line : this line worked with much more independant variables and bigger data. This time I want to work with just 2 variables cteD & cteTh. What is wrong ? > setwd("C:/Rstudio/Trot") > library(mlogit) > horse1.data<-read.csv("cte2.csv

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Good point. cc'ing Hadley. Well geom_bar help page clearly states: na.rm: If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. But they are not being removed in my example - silently or loudly. On Thu, Jul 27, 2017 at 11:18 AM, Jeff Newm

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Jeff Newmiller
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s). -- Sent from my phone. Please excuse my brevity. On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski wrote: >To clarify: my question is not about "who could I exclude NAs from >being

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Thank you, Bert! I do NOT have an object named "T" in scope (I checked - and besides, it would never occur to me to use this name). TRUE or T results in the same unexpected behavior: ggplot(data = md, mapping = aes(x = a)) + geom_bar(na.rm = TRUE) On Thu, Jul 27, 2017 at 10:57 AM, Bert Gunte

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Bert Gunter
Just a thought: Did you try na.rm = TRUE in case you have an object named "T" in scope? -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jul 27,

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
To clarify: my question is not about "who could I exclude NAs from being counted" - I know how to do that. My question is: Why na.rm = T is not working for geom_bar in this case? On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Hello! > > I am tryin

Re: [R] How long to wait for process?

2017-07-27 Thread Marc Schwartz
Hi John, Not a problem, just wanted to be sure that there was not additional confounding due to these issues. You may be aware that a subsetting operation to remove records in a data frame does not by default remove the unwanted levels from the factor that was filtered: iris.new <- subset(iri

Re: [R] How long to wait for process?

2017-07-27 Thread john polo
Marc, Sorry for the lack of info on my part. Yes, I did use 'family = binomial' and I did drop the 3rd level before running the model. I think the str() that I wrote into my original email might not have been my final step before using glm. Thank you for reminding of the potential problem.

Re: [R] How long to wait for process?

2017-07-27 Thread Marc Schwartz
Hi, Late to the thread here, but I noted that your dependent variable 'know_fin' has 3 levels in the str() output below. Since you did not provide a full c&p of your glm() call, we can only presume that you did specify 'family = binomial' in the call. Is the dataset 'knowf3' the result of a s

Re: [R] How long to wait for process?

2017-07-27 Thread john polo
Michael, Thank you for the suggestion. I will take your advice and look more critically at the covariates. John On 7/27/2017 8:08 AM, Michael Friendly wrote: Rather than go to a penalized GLM, you might be better off investigating the sources of quasi-perfect separation and simplifying the

Re: [R] How long to wait for process?

2017-07-27 Thread Michael Friendly
Rather than go to a penalized GLM, you might be better off investigating the sources of quasi-perfect separation and simplifying the model to avoid or reduce it. In your data set you have several factors with large number of levels, making the data sparse for all their combinations. Like mult

[R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Hello! I am trying to understand how ggplot2's geom_bar treats NAs. The help file says: library(ggplot2) ?geom_bar na.rm: If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. I am trying it out: md <- data.frame(a = c(letters[1:5], lette

[R] [R-pkgs] New Package vetr: Enforce Structural Requirements for S3 Objects

2017-07-27 Thread brodie gaslam via R-packages
`vetr` implements a declarative template-based approach to verify that objects meet structural requirements, and auto-composes error messages when they do not. This package is intended to simplify a more formal use of S3 objects. The template concept is borrowed from `vapply`: >> vet(numeric(1L),