Re: [R] xts/zoo index problem?

2016-01-18 Thread Huzefa Khalil
Try a["2016-01-18 15:31:54.079"] The question though is why R displays the milliseconds as "078", when it is clearly "079"... -h On Mon, Jan 18, 2016 at 8:55 PM, ce wrote: > Dear all, > > I have this code : > > library(xts) > a <- structure(c(1,2), class = c("xts", "zoo"), .indexCLASS = c("P

Re: [R] xts/zoo index problem?

2016-01-18 Thread Huzefa Khalil
Well it works when you don't put the milliseconds because it is matching that part of the date which is provided. Hence, the following all work: a["2016-01-18 15:31:54.0"] a["2016-01-18 15:31:54"] a["2016-01-18 15:31"] a["2016-01-18 15"] However, what I don't get is why it is showing 1453149114.0

Re: [R] xts/zoo index problem?

2016-01-18 Thread Joshua Ulrich
On Mon, Jan 18, 2016 at 8:31 PM, ce wrote: > > yes it shows , more interesting : > >> a["2016-01-18 15:31:54.0"] > value > 2016-01-18 15:31:54 2 > >> a["2016-01-18 15:31:54.07"] > value > >> a["2016-01-18 15:31:54.079"] > value > 2016-01-18 15:31:5

Re: [R] xts/zoo index problem?

2016-01-18 Thread ce
yes it shows , more interesting : > a["2016-01-18 15:31:54.0"] value 2016-01-18 15:31:54 2 > a["2016-01-18 15:31:54.07"] value > a["2016-01-18 15:31:54.079"] value 2016-01-18 15:31:54 2 why it doesn't work with .07 milisecond but work wit

[R] xts/zoo index problem?

2016-01-18 Thread ce
Dear all, I have this code : library(xts) a <- structure(c(1,2), class = c("xts", "zoo"), .indexCLASS = c("POSIXct", "POSIXt"), .indexTZ = "", tclass = c("POSIXct", "POSIXt"), tzone = "", index = structure(c(1453137885.23, 1453149114.079), tzone = "", tclass = c("POSIXct", "POSIXt")), .Dim = c

Re: [R] LSD value

2016-01-18 Thread Jianling Fan
Thanks David, That's exactly what I need! Thanks very much for your example. Best regards, Julian On 18 January 2016 at 13:00, David L Carlson wrote: > Providing us with a reproducible example, makes it much easier to answer your > question. The object returned by LSD.test() is completel

[R] Installation of R Rmpi and snow on cluster running Platform MPI and PBS Pro

2016-01-18 Thread Segovia, Andrea
Hello, I am new to R support. I am trying to install R on a compute cluster running Platform MPI and PBS Pro. I have installed R, Rmpi and snow - at first glance successfully. When I try to run a simple Rmpi program, however, I get a Segmentation fault on mpi send.  The error messages reads a

Re: [R] LSD value

2016-01-18 Thread David L Carlson
Providing us with a reproducible example, makes it much easier to answer your question. The object returned by LSD.test() is completely different from the object described in the "Value" section of its manual page which makes things confusing. If you look at the first example on the manual page:

Re: [R] tikzDevice and Sweave

2016-01-18 Thread Yihui Xie
Yeah, the philosophy of knitr from the very beginning is that if you want to draw a plot, simply draw it, and knitr will take care of the rest of work (http://i.imgur.com/jrwbX.jpg). You rarely need to think about graphical devices or LaTeX or a specific output format. With knitr, the example can b

[R] LSD value

2016-01-18 Thread Jianling Fan
Hello, everyone, I am using LSD.test() from package "agricolae" to do my anova analysis. I know I can calculate LSD value by its equation t*sqrt(MSE*2/n), but I am wondering if there is a code or something that can give the LSD value more directly in R? Thanks! Julian __

Re: [R] Order of formula terms in model.matrix

2016-01-18 Thread Guelman, Leo
Thanks Peter. That make sense. Nevertheless, what comes at a surprise to me (and maybe to others) is that one can potentially get different fits by simply swapping the terms in the model formula. Best, Leo. -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: 2016,

Re: [R] Order of formula terms in model.matrix

2016-01-18 Thread peter dalgaard
On 18 Jan 2016, at 16:49 , Guelman, Leo wrote: > Is it really the same model? No, and I didn't say that they would be. I did say that they would be in the all-factor case, which does seem to be right: > df$trt <- factor(df$trt) > fit1 <- glm(y ~ x1:trt + f1:trt, data = df, family = binomial)

Re: [R] Order of formula terms in model.matrix

2016-01-18 Thread Guelman, Leo
Is it really the same model? Following the example provided by Lars: set.seed(1) x1 <- rnorm(100) f1 <- factor(sample(letters[1:3], 100, replace = TRUE)) trt <- sample(c(-1,1), 100, replace = TRUE) y <- factor(sample(c(0,1), 100, T)) df <- data.frame(y=y, x1=x1, f1=f1, trt=trt) fit1 <- glm(y ~ x

Re: [R] Strange behavior with S3 class

2016-01-18 Thread S Ellison
> This is "bugged": > > str(test1)List of 1$ justaname: chr "justaname"- attr(*, "class")= chr > "eem" > This is ok:> str(test2)List of 1$ sample: chr "justaname"- attr(*, > "class")= chr > "eem2" > It seems that override of the "<-" is causing problem since in str(test1) the > variable nam

Re: [R] read in csv.-data file with blanks and missing values

2016-01-18 Thread David McPearson
swizz-john wrote: > Hi people, > > my task is to analyse data that is formatted like this. > > date,bid,name,w1,w2,w3,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,debt2mkt,cds,equity > 28jul2009,1,"ABN Amro",56.5, > 29jul2009,1,"ABN Amro",56.5, > 30jul2009,1,"ABN Amro",

Re: [R] tikzDevice and Sweave

2016-01-18 Thread Duncan Murdoch
On 18/01/2016 6:12 AM, Naresh Gurbuxani wrote: Duncan, Many thanks for looking at my code and for your suggestion. Your solution works. But my problem is different. This code gives me a tex file with a lot of tikz code. If there are several graphs in the document, then tex file become very

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-18 Thread CG Pettersson
Again: thanks a lot for all your suggestions, the problem is now solved. This combination of calls finally did the trick: > n96 <- as.matrix(n96) > frame2 <- data.frame(gushVM, n96=I(n96)) > str(frame2) 'data.frame': 15 obs. of 2 variables: $ gushVM: num 2 23.2 14.3 40.9 32.8 29.1 0 79 0 0 .

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-18 Thread Bjørn-Helge Mevik
S Ellison writes: > Reading ?plsr examples and inspecting the data they use, you need to arrange > frame1 so that it has the data from n96 included as columns with names of the > from "n96.xxx" whre xxx can be numbers, names etc. No, you do not. :) plsr() is happy with a data frame where n96 is

Re: [R] Split Strings

2016-01-18 Thread Miluji Sb
Thank you everyone for the codes and the link. They work well! Mr. Lemon, thank you for the detailed code and the explanations. I appreciate it. One thing though, in the last line sapply(split_strings,fill_strings,list(max_length,element_sets)) should it be unlist instead of list - I get this er

Re: [R] Split Strings

2016-01-18 Thread Jim Lemon
Hi Miluji, While the other answers are correct in general, I noticed that your request was for the elements of an incomplete string to be placed in the same positions as in the complete strings. Perhaps this will help: strings<-list("pc_m2_45_ssp3_wheat","pc_m2_45_ssp3_wheat", "ssp3_maize","m2_wh