Re: [R] "XLConnect" packages; Excel dates read incorrectly
Hi, Thank you for all your responses. For Eric, The files are attached. (I believe it was also attached in my first message) For David, Could you send me the link regarding possible solutions or a more comprehensive description of the problem? Thanks, John 2017-09-23 22:29 GMT-07:00 David Winsemius : > > > On Sep 23, 2017, at 6:30 AM, Eric Berger wrote: > > > > Jim, > > I don't see how that link could be related to John's issue. Symptoms > > related to your link involve discrepancies of four years whereas John is > > seeing discrepancies of one day. > > > > The MS Excel starting point was off by one day. R does not repeat that > error. MS claims that their error is justified by needing to copy the > error made by Lotus123 and then because they wanted backward compatibility. > > I'm not sure why the XLConnect package does not fix the error. They just > use the integer from Excel and let R apply it correctly. > -- > David. > > > > John, > > I do not see any attached files. > > > > Regards > > > > On Sat, Sep 23, 2017 at 1:30 PM, Jim Lemon wrote: > > > >> Hi John, > >> It could be due to this: > >> > >> https://support.microsoft.com/en-au/help/214330/differences- > >> between-the-1900-and-the-1904-date-system-in-excel > >> > >> Jim > >> > >> > >> On Sat, Sep 23, 2017 at 1:04 PM, John wrote: > >>> Hi, > >>> > >>> I tried to read xlsx files by "XLConnect" packages, but the dates are > >>> one day earlier than it is supposed to be. I moved from California to > >>> Taiwan (Eastern Asia), and it worked well in California, but not in > >> Taiwan. > >>> Even if I adjust my Mac time to California time zone, it gives the > wrong > >>> dates. I don't know which part of the setting (in RStudio or in my > Mac?) > >> I > >>> should adjust. The codes and the data are attached. > >>> > >>> My data are on weekdays, Monday to Friday every week, but they are > >> read > >>> as Sunday to Thursday. > >>> > >>> Data: > >>> 2004-01-01 (Th) > >>> 2004-01-02 (F) > >>> 2004-01-05 (M) > >>> 2004-01-06 (T) > >>> 2004-01-07 (W) > >>> 2004-01-08 (Th) > >>> 2004-01-09 (F) > >>> > >>> The data are read as: > >>> "2003-12-31" (W) > >>> "2004-01-01" (Th) > >>> "2004-01-04" (Su) > >>> "2004-01-05" (M) > >>> "2004-01-06" (Tu) > >>> "2004-01-07" (W) > >>> "2004-01-08" (Th) > >>> > >>> > >>> > >>> The codes are (also attached): > >>> > >>> > >>> rm(list=ls()) > >>> library(XLConnect) > >>> library(xlsx) > >>> > >>> fl<-paste("allData_out3.xlsx") > >>> a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric") > >>> b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric") > >>> a_col<-readWorksheetFromFile(fl, sheet="first") > >>> date11<-as.Date(a_col$date, format="%Y-%m-%d") > >>> > >>> > >>> The output: > date11 > >>> [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06" > >>> "2004-01-07" > >>> [7] "2004-01-08" "2004-01-11" "2004-01-12" "2004-01-13" "2004-01-14" > >>> "2004-01-15" > >>> [13] "2004-01-18" "2004-01-19" "2004-01-20" "2004-01-21" "2004-01-22" > >>> "2004-01-25" > >>> [19] "2004-01-26" "2004-01-27" "2004-01-28" "2004-01-29" "2004-02-01" > > >>> > >>> > >>> Thanks!! > >>> __ > >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >>> https://stat.ethz.ch/mailman/listinfo/r-help > >>> PLEASE do read the posting guide http://www.R-project.org/ > >> posting-guide.html > >>> and provide commented, minimal, self-contained, reproducible code. > >> > >> __ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide http://www.R-project.org/ > >> posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > >> > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > 'Any technology distinguishable from magic is insufficiently advanced.' > -Gehm's Corollary to Clarke's Third Law > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible co
Re: [R] gsDesign Pocock & OBF boundary
Sorry for messed up text. Here it goes again: I am learning to use the gsDesign package. I have a question about Pocock and OBF boundary. As far as I can understand, these 2 boundaries require equal spacing between interim analyses (maybe this is not correct?). But looks like I can still use gsDesign to run an analysis based on unequal spacing: > gsDesign(k=2,test.type=2,timing=c(0.75,1),alpha=0.05,sfu='Pocock') Symmetric two-sided group sequential design with 90 %power and 5 % Type I Error.Spending computations assume trial stops if a bound is crossed. Sample Size Analysis Ratio* Z Nominal p Spend 1 0.796 1.82 0.0346 0.0346 2 1.061 1.82 0.0346 0.0154 Total 0.0500 ++alpha spending: Pocock boundary.*Sample size ratio compared to fixed design with no interim Can anyone share some light whether the above analysis is still valid? Or for unequal spacing, I have to use Lan-Demet’s error spending function approximations? Thank you, From: Berend Hasselman To: array chip Cc: R-help Mailing List Sent: Friday, September 22, 2017 11:46 PM Subject: Re: [R] gsDesign Pocock & OBF boundary > On 23 Sep 2017, at 01:32, array chip via R-help wrote: > > Hi, > > I am learning to use your gsDesign package! I have a question about Pocock > and OBF boundary. As far as Iunderstand, these 2 boundaries require equal > spacing between interim analyses(maybe this is not correct?). But I can still > use gsDesign to run an analysisbased on unequal spacing: > gsDesign(k=2,test.type=2,timing=c(0.75,1),alpha=0.05,sfu='Pocock')Symmetrictwo-sided > group sequential design with90 %power and 5 % Type I > Error.Spendingcomputations assume trial stops if a bound is crossed. > Sample Size AnalysisRatio* Z Nominal p Spend 1 0.796 > 1.82 0.0346 0.0346 2 1.061 1.82 0.0346 0.0154 Total > 0.0500 ++alpha spending:Pocockboundary.*Sample size ratio > compared to fixed design with no interim Can anyone share some light whether > the above analysis is stillvalid? Or for unequal spacing, I have to use > Lan-Demet’s error spendingfunction approximations? Thank you, > [[alternative HTML version deleted]] > Your example code is a complete mess. Do NOT post in html. This is a plain text mailing list. Read the Posting Guide (https://www.r-project.org/posting-guide.html). Berend Hasselman] > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] "XLConnect" packages; Excel dates read incorrectly
> On Sep 23, 2017, at 6:30 AM, Eric Berger wrote: > > Jim, > I don't see how that link could be related to John's issue. Symptoms > related to your link involve discrepancies of four years whereas John is > seeing discrepancies of one day. > The MS Excel starting point was off by one day. R does not repeat that error. MS claims that their error is justified by needing to copy the error made by Lotus123 and then because they wanted backward compatibility. I'm not sure why the XLConnect package does not fix the error. They just use the integer from Excel and let R apply it correctly. -- David. > John, > I do not see any attached files. > > Regards > > On Sat, Sep 23, 2017 at 1:30 PM, Jim Lemon wrote: > >> Hi John, >> It could be due to this: >> >> https://support.microsoft.com/en-au/help/214330/differences- >> between-the-1900-and-the-1904-date-system-in-excel >> >> Jim >> >> >> On Sat, Sep 23, 2017 at 1:04 PM, John wrote: >>> Hi, >>> >>> I tried to read xlsx files by "XLConnect" packages, but the dates are >>> one day earlier than it is supposed to be. I moved from California to >>> Taiwan (Eastern Asia), and it worked well in California, but not in >> Taiwan. >>> Even if I adjust my Mac time to California time zone, it gives the wrong >>> dates. I don't know which part of the setting (in RStudio or in my Mac?) >> I >>> should adjust. The codes and the data are attached. >>> >>> My data are on weekdays, Monday to Friday every week, but they are >> read >>> as Sunday to Thursday. >>> >>> Data: >>> 2004-01-01 (Th) >>> 2004-01-02 (F) >>> 2004-01-05 (M) >>> 2004-01-06 (T) >>> 2004-01-07 (W) >>> 2004-01-08 (Th) >>> 2004-01-09 (F) >>> >>> The data are read as: >>> "2003-12-31" (W) >>> "2004-01-01" (Th) >>> "2004-01-04" (Su) >>> "2004-01-05" (M) >>> "2004-01-06" (Tu) >>> "2004-01-07" (W) >>> "2004-01-08" (Th) >>> >>> >>> >>> The codes are (also attached): >>> >>> >>> rm(list=ls()) >>> library(XLConnect) >>> library(xlsx) >>> >>> fl<-paste("allData_out3.xlsx") >>> a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric") >>> b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric") >>> a_col<-readWorksheetFromFile(fl, sheet="first") >>> date11<-as.Date(a_col$date, format="%Y-%m-%d") >>> >>> >>> The output: date11 >>> [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06" >>> "2004-01-07" >>> [7] "2004-01-08" "2004-01-11" "2004-01-12" "2004-01-13" "2004-01-14" >>> "2004-01-15" >>> [13] "2004-01-18" "2004-01-19" "2004-01-20" "2004-01-21" "2004-01-22" >>> "2004-01-25" >>> [19] "2004-01-26" "2004-01-27" "2004-01-28" "2004-01-29" "2004-02-01" >>> >>> >>> Thanks!! >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] "XLConnect" packages; Excel dates read incorrectly
Jim, I don't see how that link could be related to John's issue. Symptoms related to your link involve discrepancies of four years whereas John is seeing discrepancies of one day. John, I do not see any attached files. Regards On Sat, Sep 23, 2017 at 1:30 PM, Jim Lemon wrote: > Hi John, > It could be due to this: > > https://support.microsoft.com/en-au/help/214330/differences- > between-the-1900-and-the-1904-date-system-in-excel > > Jim > > > On Sat, Sep 23, 2017 at 1:04 PM, John wrote: > > Hi, > > > >I tried to read xlsx files by "XLConnect" packages, but the dates are > > one day earlier than it is supposed to be. I moved from California to > > Taiwan (Eastern Asia), and it worked well in California, but not in > Taiwan. > > Even if I adjust my Mac time to California time zone, it gives the wrong > > dates. I don't know which part of the setting (in RStudio or in my Mac?) > I > > should adjust. The codes and the data are attached. > > > >My data are on weekdays, Monday to Friday every week, but they are > read > > as Sunday to Thursday. > > > > Data: > > 2004-01-01 (Th) > > 2004-01-02 (F) > > 2004-01-05 (M) > > 2004-01-06 (T) > > 2004-01-07 (W) > > 2004-01-08 (Th) > > 2004-01-09 (F) > > > > The data are read as: > > "2003-12-31" (W) > > "2004-01-01" (Th) > > "2004-01-04" (Su) > > "2004-01-05" (M) > > "2004-01-06" (Tu) > > "2004-01-07" (W) > > "2004-01-08" (Th) > > > > > > > > The codes are (also attached): > > > > > > rm(list=ls()) > > library(XLConnect) > > library(xlsx) > > > > fl<-paste("allData_out3.xlsx") > > a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric") > > b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric") > > a_col<-readWorksheetFromFile(fl, sheet="first") > > date11<-as.Date(a_col$date, format="%Y-%m-%d") > > > > > > The output: > >> date11 > > [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06" > > "2004-01-07" > > [7] "2004-01-08" "2004-01-11" "2004-01-12" "2004-01-13" "2004-01-14" > > "2004-01-15" > > [13] "2004-01-18" "2004-01-19" "2004-01-20" "2004-01-21" "2004-01-22" > > "2004-01-25" > > [19] "2004-01-26" "2004-01-27" "2004-01-28" "2004-01-29" "2004-02-01" > >> > > > > > > Thanks!! > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] "XLConnect" packages; Excel dates read incorrectly
Hi John, It could be due to this: https://support.microsoft.com/en-au/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel Jim On Sat, Sep 23, 2017 at 1:04 PM, John wrote: > Hi, > >I tried to read xlsx files by "XLConnect" packages, but the dates are > one day earlier than it is supposed to be. I moved from California to > Taiwan (Eastern Asia), and it worked well in California, but not in Taiwan. > Even if I adjust my Mac time to California time zone, it gives the wrong > dates. I don't know which part of the setting (in RStudio or in my Mac?) I > should adjust. The codes and the data are attached. > >My data are on weekdays, Monday to Friday every week, but they are read > as Sunday to Thursday. > > Data: > 2004-01-01 (Th) > 2004-01-02 (F) > 2004-01-05 (M) > 2004-01-06 (T) > 2004-01-07 (W) > 2004-01-08 (Th) > 2004-01-09 (F) > > The data are read as: > "2003-12-31" (W) > "2004-01-01" (Th) > "2004-01-04" (Su) > "2004-01-05" (M) > "2004-01-06" (Tu) > "2004-01-07" (W) > "2004-01-08" (Th) > > > > The codes are (also attached): > > > rm(list=ls()) > library(XLConnect) > library(xlsx) > > fl<-paste("allData_out3.xlsx") > a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric") > b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric") > a_col<-readWorksheetFromFile(fl, sheet="first") > date11<-as.Date(a_col$date, format="%Y-%m-%d") > > > The output: >> date11 > [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06" > "2004-01-07" > [7] "2004-01-08" "2004-01-11" "2004-01-12" "2004-01-13" "2004-01-14" > "2004-01-15" > [13] "2004-01-18" "2004-01-19" "2004-01-20" "2004-01-21" "2004-01-22" > "2004-01-25" > [19] "2004-01-26" "2004-01-27" "2004-01-28" "2004-01-29" "2004-02-01" >> > > > Thanks!! > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.