[R] ggplot2: geom_segment does not produce the color I desire?

2016-09-16 Thread John
Hi, I have a dataset "test". I try to produce a "green" arrow but it gives a "red" arrow (as attached). Could someone tell me how I can fix it? Thanks, > test dateco y1 y2 5 2011-11-28 green 196.6559 1.600267 > dput(test) structure(list(date = structure(15306, class =

Re: [R] NaN Log-lik value in EM algorithm (fitting Gamma mixture model)

2016-09-16 Thread William Dunlap via R-help
You should report the issue to the author/maintainer of the mixtools package. gammamixEM can get into this situation when the data is not an obvious mixture so it has a hard time coming up with a good starting point for the coefficient estimates. E.g., > out <-

Re: [R] NaN Log-lik value in EM algorithm (fitting Gamma mixture model)

2016-09-16 Thread Aanchal Sharma
Data has no negative values. Values range from 0.001 to 1.01. Following is the summary, in case that helps: Min. 1st Qu. MedianMean 3rd Qu.Max. 0.0010 0.8126 0.8536 0.8464 0. 1.0180 SD: 0.07489977 Any clue? On Thu, Sep 15, 2016 at 10:32 PM, William Dunlap

[R] Fwd: stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Gabor Grothendieck
1. Convert the date from R's origin to the origin used by SQLite's strftime function and then be sure you are using the correct SQLite strftime syntax: library(sqldf) sqldf("select strftime('%m', Date + 2440588.5) month from log") 2. Alternately use the H2 backend which actually supports

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
Yes, some of my info was outdated and misleading. :) However, after I RTFM [1] it becomes clear that the strftime function being invoked in the SQL statement has completely different parameters (both ordering and interpretation) and behavior than the strftime function in R, and that is the

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
First of all I would like to say thanks to everyone for sharing valuable information, now I can able to do that if date column datatype is “Factor” but by default the date column datatype is “POSIXct” in R ,so whenever I want apply stfrtime function with sqldf package ,do I need to convert the

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread peter dalgaard
On 16 Sep 2016, at 15:23 , PIKAL Petr wrote: > Hi Peter > > The devil is in detail > > Data from OP had different format and was transferred to Date object by > as.Date, which results in incorrect values (and NA if not transferred) > df <- data.frame(Date = >

Re: [R] Query to find minimum value in a matrix in R

2016-09-16 Thread PIKAL Petr
Hi you can follow logic of functions by using debug and see how they operate by inspecting objects evaluated within functions. See ?debug However it seems to me that your functions are quite complicated. If I understand correctly, they compute minimum value of upper part of matrix. If I am

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Gabor Grothendieck
To be precise it's SQLite that does not have date and time data types. If you use an sqldf backend such as H2 that does have such types then sqldf will pass them as such. In the case of R's "Date" class such objects are passed to SQLite as numbers since that is what SQLite can understand but they

Re: [R] Query to find minimum value in a matrix in R

2016-09-16 Thread S Ellison
> I am unable to understand the line in red code Colour does not survive plain text transmission; try adding comments (# ...) instead, or state which line of code you do not understand. In the mean time you could take a look, first, as ?cbind ?apply ?'[' with particular attention to the

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
SQLite only understands certain fundamental data types, and neither Date nor POSIXct types are among them. They get stored as their internal numeric representations. The internal numeric representations of Date and POSIXct are incompatible. You are sending Dates to SQLite and trying to then

[R] Query to find minimum value in a matrix in R

2016-09-16 Thread susmita T
Hi, Good Morning! I am new to R and finding difficulty in understanding the code. Since few days I am stuck at single line of code which I am unable to understand. Though there may be number of logics to find min value. As a new beginner I am following a book and as it has the following code

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
Hi Peter The devil is in detail Data from OP had different format and was transferred to Date object by as.Date, which results in incorrect values (and NA if not transferred) df <- data.frame(Date = c("2013/05/25","2013/05/28","2013/05/31","2013/06/01","2013/06/02", "2013/06/05","2013/06/07"),

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread peter dalgaard
Presumably, sqldf does not know about Date object so passes an integer that gets interpreted as who knows what... This seems to work: > df <- data.frame(date=as.character(Sys.Date()+seq(0,180,,10))) > cbind(df, sqldf("select strftime( '%m', date) from df")) date strftime( '%m', date) 1

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
Hi Most probably there is some syntactic suger how to correctly formulate sql query. > sqldf('select Date, strftime("Date", "%m") from log') Date strftime("Date", "%m") 1 2013-05-25 2 2013-05-28 3 2013-05-31 4 2013-06-01

Re: [R] Visualizing and clustering one half of a symmetric matrix

2016-09-16 Thread Khan, Saad M. (MU-Student)
I do want to cluster it and only plot the lower half of the matrix. From: Peter Langfelder Sent: Thursday, September 15, 2016 11:33:13 PM To: Khan, Saad M. (MU-Student) Cc: r-help@R-project.org Subject: Re: [R] Visualizing and

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
Hi Petr, Thanks, For me also it’s working fine when I directly used that function but when I call strftime function through sqldf package it’s returning NA values (PFA) ,but my requirement is I need to do that only sqldf as I’m writing some “T sql ” queries against on the dataset. Manu.

Re: [R] apply weight to a data frame

2016-09-16 Thread PIKAL Petr
Hi Pls, keep conversation on list, you can get answer from others, more capable than myself in survey analysis. As I said I am not an expert in this task but you seem to seek some statistical help. For this maybe stackexchange can be more appropriate. If you want some help here, you should

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
Hi Hm > format(log$Date, "%m") [1] "05" "05" "05" "06" "06" "06" "06" > strftime(log$Date, "%m") [1] "05" "05" "05" "06" "06" "06" "06" > works for me. Just a blind guess, is an object date somwhere in your environment? Cheers Petr > -Original Message- > From: R-help

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
Jeff, Thanks,my question is when I’m using strftime function in sqldf package it’s not returning the results which has supposed to return ,now how can I get the excat month from my sample data with strftime function through sqldf package ? Manu. On Fri, Sep 16, 2016 at 11:32 AM, Jeff

Re: [R] apply weight to a data frame

2016-09-16 Thread PIKAL Petr
Hi I do not know much about plm but your request seems to me pretty cryptic, probably even for knowledgeable person. There is no weight argument in plm call so I wonder how do you want to "weight data frame". The only weighting scheme for data frame I can imagine is to repeat rows somehow

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
This question is missing pieces... the example is incomplete. -- Sent from my phone. Please excuse my brevity. On September 15, 2016 9:35:45 PM PDT, Manohar Reddy wrote: >Hi , > > > >I have data something looks like below (or PFA), but when I’m >extracting >month