Re: [R] Zoo changing time-zone when I merge 2 zoo time series

2018-07-18 Thread Enrico Schumann
On Mon, 09 Jul 2018, Christofer Bogaso writes: > Hi, > > Below is my code : > > library(zoo) > Dat1 = structure(c(17890, 17770.01, 17600, 17593, 17630.01), index = > structure(c(1512664740, > 1512664800, 1512664860, 1512664920, 1512664980), class = c("POSIXct", > "POSIXt"), tzone = "America/Los_An

Re: [R] GGPlot plot

2018-07-18 Thread Francesca
Thanks for the answer. Il gio 19 lug 2018, 01:04 Jim Lemon ha scritto: > Hi Francesca, > This looks like a fairly simple task. Try this: > > fpdf<-read.table(text="PASP SUBJC > 0 0 > 4 1 > 0 0 > 8 0 > 4 0 > 0 1 > 0 1", > he

Re: [R] help with merging two dataframes function of "egrep"-like formulas

2018-07-18 Thread Bogdan Tanasa
it looks great, thank you very much Jeff for your time and kind help ! On Wed, Jul 18, 2018 at 7:51 PM, Jeff Newmiller wrote: > The traditional (SQL) way to attack this problem is to make the data > structure simpler so that faster comparisons can be utilized: > > > A <- data.fr

Re: [R] help with merging two dataframes function of "egrep"-like formulas

2018-07-18 Thread Jeff Newmiller
The traditional (SQL) way to attack this problem is to make the data structure simpler so that faster comparisons can be utilized: A <- data.frame(z=c("a*b", "c*d", "d*e", "e*f"), t =c(1, 2, 3, 4)) B <- data.frame(z=c("a*b::x*y", "c", "", "g*h"), t =c(1, 2, 3, 4)) library(dplyr

Re: [R] xtable does not print out units of a variable

2018-07-18 Thread Jeff Newmiller
On Wed, 18 Jul 2018, Shawn Way wrote: I have a dataframe that contains units using the units package. Unfortunately, I really need the units for reporting. I'm assuming that's because the data is in a class units and xtable doesn't know what to do with this. If you want a bug or feature in

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
On Wed, 18 Jul 2018, David Winsemius wrote: It's not so much as factors but rather in a form that paste() will coerce to character so you cna get the automatic format David, Now I understand. Maybe you need to add a format string. It might force some of your pasted date+time values to NA

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread David Winsemius
> On Jul 18, 2018, at 4:07 PM, Rich Shepard wrote: > > On Wed, 18 Jul 2018, David Winsemius wrote: > >> I would not destroy the possibility of using the original values: > > David, > > What are the benefits of keeping date and time as factors? > >>> allyears$myDate <- as.Date(as.character(

Re: [R] Query regarding simulating weibull aft model with predefined censoring rate

2018-07-18 Thread Bert Gunter
Off topic for r-help (see posting guide linked below). Suggest Posting on stats.stackexchange.com instead.. Cheers, 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

Re: [R] GGPlot plot

2018-07-18 Thread Jim Lemon
Hi again, Sorry, forgot this line: fpdf$PASPpos<-fpdf$PASP > 0 just after reading in the data frame. Jim On Thu, Jul 19, 2018 at 9:04 AM, Jim Lemon wrote: > Hi Francesca, > This looks like a fairly simple task. Try this: > > fpdf<-read.table(text="PASP SUBJC > 0 0 > 4 1

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
On Wed, 18 Jul 2018, David Winsemius wrote: I would not destroy the possibility of using the original values: David, What are the benefits of keeping date and time as factors? allyears$myDate <- as.Date(as.character(allyears$date)) allyears$myTime <- as.POSIXct(paste(allyears$date, allyea

Re: [R] GGPlot plot

2018-07-18 Thread Jim Lemon
Hi Francesca, This looks like a fairly simple task. Try this: fpdf<-read.table(text="PASP SUBJC 0 0 4 1 0 0 8 0 4 0 0 1 0 1", header=TRUE) # get the number of positive PASP results by group ppos<-by(fpdf$SUBJC,fpdf$PASPpos,su

Re: [R] help with merging two dataframes function of "egrep"-like formulas

2018-07-18 Thread Bogdan Tanasa
Dear Riley, thank you very much for your help and solution. I got some inspiration from stackoverflow website, and I did use sqldf library. It looks that the formula below works too. Thanks a lot ! sqldf("select B.*, A.* from B left join A on instr(B.z, A.z)") On Wed, Jul 18, 2018 at 3:57 PM,

Re: [R] help with merging two dataframes function of "egrep"-like formulas

2018-07-18 Thread Bogdan Tanasa
Thanks a lot ! It looks that I am getting the same results with : B %>% regex_left_join(A, by = c(z = 'z')) On Wed, Jul 18, 2018 at 3:57 PM, Riley Finn wrote: > please may I ask for a piece of advise regarding merging two dataframes : >> A <- data.frame(z=c("a*b", "c*d", "d*e", "e*f"), t =c(1,

[R] xtable does not print out units of a variable

2018-07-18 Thread Shawn Way
I have a dataframe that contains units using the units package. Unfortunately, I really need the units for reporting. I'm assuming that's because the data is in a class units and xtable doesn't know what to do with this. The following is a MWE: library(xtable) library(units) data

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread David Winsemius
> On Jul 18, 2018, at 2:50 PM, Rich Shepard wrote: > > A set of data files have this format: > > date,time,elev > 1988-10-01,00:30,87.6849 > 1988-10-01,01:00,87.6849 > 1988-10-01,01:30,87.6849 > 1988-10-01,02:00,87.6879 > 1988-10-01,02:30,87.6879 > 1988-10-01,03:00,87.691 > 1988-10-01,03:30,8

[R] help with merging two dataframes function of "egrep"-like formulas

2018-07-18 Thread Bogdan Tanasa
Dear all, please may I ask for a piece of advise regarding merging two dataframes : A <- data.frame(z=c("a*b", "c*d", "d*e", "e*f"), t =c(1, 2, 3, 4)) B <- data.frame(z=c("a*b::x*y", "c", "", "g*h"), t =c(1, 2, 3, 4)) function of the criteria : if "the elements in the 1st column of A could be

[R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
A set of data files have this format: date,time,elev 1988-10-01,00:30,87.6849 1988-10-01,01:00,87.6849 1988-10-01,01:30,87.6849 1988-10-01,02:00,87.6879 1988-10-01,02:30,87.6879 1988-10-01,03:00,87.691 1988-10-01,03:30,87.694 Importing it with this command: allyears <- read.table('allyears.da

[R] Query regarding simulating weibull aft model with predefined censoring rate

2018-07-18 Thread Fabiha Binte Farooq
Hi there, I am an MS student from Bangladesh. I am doing thesis in my MS degree. In my research, I am generating data from weibull distribution and my model is accelerated failure time (AFT) model. I am considering right censoring as well as covariates. Now I have been facing difficulties to genera

Re: [R] Suggestions for scatter plot of many data

2018-07-18 Thread David Winsemius
> On Jul 18, 2018, at 1:55 PM, Rich Shepard wrote: > > I have daily precipitation data for 58 locations from 2005-01-01 through > 2018-06-18. Among other plots and analyses I want to apply lattice's > xyplot() to illustrate the abundance and patterns of the data. > > I've used a vector of co

[R] Suggestions for scatter plot of many data

2018-07-18 Thread Rich Shepard
I have daily precipitation data for 58 locations from 2005-01-01 through 2018-06-18. Among other plots and analyses I want to apply lattice's xyplot() to illustrate the abundance and patterns of the data. I've used a vector of colors (and a key) when there were only eight weather stations and

Re: [R] GGPlot plot

2018-07-18 Thread Jeff Newmiller
On Wed, 18 Jul 2018, Francesca wrote: Dear R help, I am new to ggplot so I apologize if my question is a bit obvious. Or perhaps not, as this is the "R-help" mailing list, not the "Ggplot-help" mailing list. Fortunately for you, what you really need to learn is R, and then ggplot will be

Re: [R] GGPlot plot

2018-07-18 Thread Rui Barradas
Hello, Your request is not entirely clear. What kind of a graph do you want? A bar graph with a bar of the fraction of positive levels of PASP per each level of SUBJC? You need to be more specific. Also, please post data like this: # post the output of this command in your next mail dput(hea

[R] GGPlot plot

2018-07-18 Thread Francesca
Dear R help, I am new to ggplot so I apologize if my question is a bit obvious. I would like to create a plot where a compare the fraction of the values of a variable called PASP out of the number of subjects, for two groups of subject codified with a dummy variable called SUBJC. The variable

[R] Help with knitr pkg

2018-07-18 Thread Bill Poling
Hi, I worked through this excellent tutorial: #Elegant regression results tables and plots in R: the finalfit package https://www.r-bloggers.com/elegant-regression-results-tables-and-plots-in-r-the-finalfit-package/ Now I am applying it to my own data. In the tutorial there is mention of: # Ta

Re: [R] Scaling - does it get any better results than not scaling?

2018-07-18 Thread Michael Thompson
My thanks to all contributors, and while I was not in the right place, I certainly got the answers I needed. My students will benefit, so thank you all. Regards, Michael Thompson M.Prof.Studies Data Science 09 975 4678 Senior Lecturer, Digital Technologies Manukau Campus We all, like sheep, have