That's really an ambitious project. I'm giving it a try and as soon as possible
will put a brief review here on the list.
See you
Joao P Dubas
--- In sportsci_rtutorial@yahoogroups.com, "gerrobrein" <gerrobrein@...> wrote:
>
> Hello guys,
>
> Maybe you wanna check out this new Java interface for R.
>
> http://biocep-distrib.r-forge.r-project.org/
>
> Appears to be quite an ambitious project including cloud computing, web
services, and further abstractions involving usage of R.
>
> Looks like putting your bet on R is well-worth it.
> Go Open-Source!
>
> Cheers
> Rob
>
Sorry, third try
http://sports.groups.yahoo.com/group/sportsci_rtutorial/files/Misc/R.eye.candy.p\
pt
--- In sportsci_rtutorial@yahoogroups.com, Ian Shrier <ian.shrier@...> wrote:
>
> Rob
>
> there wasn't any link
>
>
> Ian Shrier MD, PhD, Dip Sport Med, FACSM
> Associate Professor, Dep't of Fam Med, McGill University
> Past-President, Canadian Academy of Sport Medicine
> Check out: www.casm-acms.org
> SKYPE name: ian.shrier
>
> Centre for Clinical Epidemiology and Community Studies
> SMBD-Jewish General Hospital
> 3755 Cote Ste-Catherine Rd
> Montreal, Qc H3T 1E2
> Tel: 514-340-7563
> Fax: 514-340-7564
>
>
>
>
>
> On 5-Apr-09, at 7:44 AM, gerrobrein wrote:
>
> > Hi everybody,
> >
> > If you need some fancy animations for your next presentation/seminar
> > check out the animation package in R. The package comes with some
> > nice examples and the interface is pretty straightforward.
> >
> > It basically allows you to generate SWF (Flash) files directly out
> > of R. I uploaded a little example into the Files/Misc folder. The
> > ppt-file includes a tiny macro as swf-support in PPT is somewhat
> > weak and affords a little help through VBA.
> >
> > Cheers
> > Rob
> >
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
Rob
there wasn't any link
Ian Shrier MD, PhD, Dip Sport Med, FACSM
Associate Professor, Dep't of Fam Med, McGill University
Past-President, Canadian Academy of Sport Medicine
Check out: www.casm-acms.org
SKYPE name: ian.shrier
Centre for Clinical Epidemiology and Community Studies
SMBD-Jewish General Hospital
3755 Cote Ste-Catherine Rd
Montreal, Qc H3T 1E2
Tel: 514-340-7563
Fax: 514-340-7564
On 5-Apr-09, at 7:44 AM, gerrobrein wrote:
> Hi everybody,
>
> If you need some fancy animations for your next presentation/seminar
> check out the animation package in R. The package comes with some
> nice examples and the interface is pretty straightforward.
>
> It basically allows you to generate SWF (Flash) files directly out
> of R. I uploaded a little example into the Files/Misc folder. The
> ppt-file includes a tiny macro as swf-support in PPT is somewhat
> weak and affords a little help through VBA.
>
> Cheers
> Rob
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
Hi everybody,
If you need some fancy animations for your next presentation/seminar check out
the animation package in R. The package comes with some nice examples and the
interface is pretty straightforward.
It basically allows you to generate SWF (Flash) files directly out of R. I
uploaded a little example into the Files/Misc folder. The ppt-file includes a
tiny macro as swf-support in PPT is somewhat weak and affords a little help
through VBA.
Cheers
Rob
Hello guys,
Maybe you wanna check out this new Java interface for R.
http://biocep-distrib.r-forge.r-project.org/
Appears to be quite an ambitious project including cloud computing, web
services, and further abstractions involving usage of R.
Looks like putting your bet on R is well-worth it.
Go Open-Source!
Cheers
Rob
Hi All,
Analytics Training Institute is launching a course on R statistical
software. For further course details please visit
www.analyticstraining.in.
We also have an online training program for R course.
You can also send in your queries at info@....
For any details contact us at 91.80.41540941 or +91-9611117256
Regards
ATI Team
Hello Guys,
I've checked out, although only brief and superficial, R commander.
The interface provides most of the typical tests used in
undergraduate training. Thus, it could be used to ease novices into
working with R.
Check out:
http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/
It is also possible to extend the basic functionality and write add-
on menus for new routines. Could be usefull if you tend to use the
same routines again and again in your team and you have somebody
knowing how to programm in R and Tcl/Tk. This way, simply add a new
menu entry, and everybody can make happy mice clicking (at least in
principle). Thus, providing similiar out-of-the-box functionality
just like Will does through his Excel sheets.
Therefore check it out.
Cheers
Rob
>
> I agree with Rob that the menu-driven approach is limited to
simple
> analyses. But this is going to be adequate for many studies.
>
> I also have become more aware of all the grave statistical mistakes
I
> have made in the past. If you don't have the time to learn how to
> program (in at least one of the software packages) for the more
> complicated analyses (and maybe even for the simple ones), then
you
> probably don't have the time to learn all the nuances and things
to
> avoid doing that everyone is else is doing but doing them wrong. I
> have had some wonderful collaborations with statisticians and if
you
> can find one that is interested in your research question, use him/
her
> - it is also a great way to get free private tutoring.
>
> Here is a little saying that maybe is a bit harsh and over the
top,
> but it does make a point that we have to be very careful:
> _______
> "A mistake in the operating room can threaten the life of one
patient;
> a mistake in statistical analysis or interpretation can lead to
> hundreds of early deaths. So it is perhaps odd that, while we allow
a
> doctor to conduct surgery only after years of training, we give
SPSS
> to almost anyone"
>
> Vickers A. Interpreting data from randomized trials: the
Scandinavian
> prostatectomy study illustrates two common errors. Nat Clin Pract
Urol
> 2005;2(9):404-5.
> ________
>
> Ian Shrier MD, PhD, Dip Sport Med, FACSM
> Associate Professor, Dep't of Fam Med, McGill University
> Past-President, Canadian Academy of Sport Medicine
> Check out: www.casm-acms.org
> SKYPE name: ian.shrier
>
> Centre for Clinical Epidemiology and Community Studies
> SMBD-Jewish General Hospital
> 3755 Cote Ste-Catherine Rd
> Montreal, Qc H3T 1E2
> Tel: 514-340-7563
> Fax: 514-340-7564
>
>
>
>
>
> On 9-Jan-09, at 5:53 PM, gerrobrein wrote:
>
> > Hi Will,
> >
> > Great to see some action happening on this list.
> > Personally, I don't think that providing a menu-driven interface
is
> > of any help. We discussed it a while ago when you came down to
> > Dunedin. I really am convinced that tables and mice don't do the
> > trick. Also, I'm 100% percent sure that an undergrad not being
> > polluted by Excel, SPSS or the like (try SPSS's scripting
language if
> > you want to see strange concepts by the way) will learn R in no
time.
> > Getting used to the commands may seem complicated at first but
once
> > you deal with real data, which tends to be really messy, it will
be
> > difficult to find the right menu anyway, because typically it
doesn't
> > exist yet.
> > Further, as the amount of data in our area is also constantly on
the
> > rise: From my own experience, for my master and my PhD I analyzed
> > whole body joint kinematics:
> > Master: ~216000 Data pts
> > PhD: ~157500000 Data pts
> > Today, there is just no escape from getting profficient in at
least
> > one programming language. Might as well be R.
> > Anyway, I'll try the R commander over the weekend and give some
> > feedback.
> >
> > Cheers
> > Rob
> >
> > --- In sportsci_rtutorial@yahoogroups.com, "Will Hopkins" <will@>
> > wrote:
> >>
> >> I presume folks won't mind if this interaction continues via the
> > list.
> >> Others might make some useful comments.
> >>
> >>
> >>
> >> I hadn't realized a menu-driven R was up and running. If that's
> > what the
> >> NYT article was referring to, it would imply that menu-driven R
is
> > easier to
> >> use than all the other menu-driven stats packages. Is R's menu
> > interface any
> >> different from any other? Does the interface somehow capture R's
> > strange
> >> concepts/jargon for specifying data and models (which I still
> > haven't
> >> attempted to understand, I must admit)?
> >>
> >>
> >>
> >> Will
> >>
> >>
> >>
> >> From: sportsci_rtutorial@yahoogroups.com
> >> [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of Ian
Shrier
> >> Sent: Friday, 9 January 2009 11:17 a.m.
> >> To: sportsci_rtutorial@yahoogroups.com
> >> Subject: Re: [sportsci_rtutorial] R article at the new york times
> >>
> >>
> >>
> >> Will
> >>
> >>
> >>
> >> Within R, there is a feature called R Commander. Once loaded, it
is
> >> menu-driven. Further, as it runs, it writes the code so you learn
> > how to
> >> program as you go along.
> >>
> >>
> >>
> >> Unfortunately, I only learned about it after I went through the
> > steepest
> >> part of the learning curve. And although I probably should use it
> > sometimes,
> >> I tend to rely on the help documentation or my statistician
friend
> > who is an
> >> R grand master...very helpful if you have one.
> >>
> >>
> >>
> >> Ian Shrier MD, PhD, Dip Sport Med, FACSM
> >> Associate Professor, Dep't of Fam Med, McGill University
> >>
> >> Past-President, Canadian Academy of Sport Medicine
> >>
> >> Check out: www.casm-acms.org
> >> SKYPE name: ian.shrier
> >>
> >> Centre for Clinical Epidemiology and Community Studies
> >> SMBD-Jewish General Hospital
> >> 3755 Cote Ste-Catherine Rd
> >> Montreal, Qc H3T 1E2
> >> Tel: 514-340-7563
> >> Fax: 514-340-7564
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 8-Jan-09, at 4:05 PM, Will Hopkins wrote:
> >>
> >>
> >>
> >>
> >>
> >> "But R has also quickly found a following because statisticians,
> > engineers
> >> and scientists without computer programming skills find it easy
to
> > use."
> >>
> >> This is an example of why I don't read newspapers on or off line.
> >>
> >>
> >>
> >> Will
> >>
> >>
> >>
> >> From: sportsci_rtutorial@yahoogroups.com
> >> [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of
gerrobrein
> >> Sent: Friday, 9 January 2009 1:29 a.m.
> >> To: sportsci_rtutorial@yahoogroups.com
> >> Subject: [sportsci_rtutorial] R article at the new york times
> >>
> >>
> >>
> >> http://www.nytimes.com/2009/01/07/technology/business-
> >> computing/07program.html?_r=2
> >>
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
I agree with Rob that the menu-driven approach is limited to simple analyses. But this is going to be adequate for many studies.
I also have become more aware of all the grave statistical mistakes I have made in the past. If you don't have the time to learn how to program (in at least one of the software packages) for the more complicated analyses (and maybe even for the simple ones), then you probably don't have the time to learn all the nuances and things to avoid doing that everyone is else is doing but doing them wrong. I have had some wonderful collaborations with statisticians and if you can find one that is interested in your research question, use him/her - it is also a great way to get free private tutoring.
Here is a little saying that maybe is a bit harsh and over the top, but it does make a point that we have to be very careful:
_______
“A mistake in the operating room can threaten
the life of one patient; a mistake in statistical analysis or interpretation
can lead to hundreds of early deaths. So it is perhaps odd that, while we allow
a doctor to conduct surgery only after years of training, we give SPSS to
almost anyone”
Vickers
A. Interpreting data from randomized trials: the Scandinavian prostatectomy
study illustrates two common errors. Nat Clin Pract Urol 2005;2(9):404-5.
________
Ian Shrier MD, PhD, Dip Sport Med, FACSM Associate Professor, Dep't of Fam Med, McGill University
Past-President, Canadian Academy of Sport Medicine
Centre for Clinical Epidemiology and Community Studies SMBD-Jewish General Hospital 3755 Cote Ste-Catherine Rd Montreal, Qc H3T 1E2 Tel: 514-340-7563 Fax: 514-340-7564
On 9-Jan-09, at 5:53 PM, gerrobrein wrote:
Hi Will,
Great to see some action happening on this list. Personally, I don't think that providing a menu-driven interface is of any help. We discussed it a while ago when you came down to Dunedin. I really am convinced that tables and mice don't do the trick. Also, I'm 100% percent sure that an undergrad not being polluted by Excel, SPSS or the like (try SPSS's scripting language if you want to see strange concepts by the way) will learn R in no time. Getting used to the commands may seem complicated at first but once you deal with real data, which tends to be really messy, it will be difficult to find the right menu anyway, because typically it doesn't exist yet. Further, as the amount of data in our area is also constantly on the rise: From my own experience, for my master and my PhD I analyzed whole body joint kinematics: Master: ~216000 Data pts PhD: ~157500000 Data pts Today, there is just no escape from getting profficient in at least one programming language. Might as well be R. Anyway, I'll try the R commander over the weekend and give some feedback.
Hi Will,
Great to see some action happening on this list.
Personally, I don't think that providing a menu-driven interface is
of any help. We discussed it a while ago when you came down to
Dunedin. I really am convinced that tables and mice don't do the
trick. Also, I'm 100% percent sure that an undergrad not being
polluted by Excel, SPSS or the like (try SPSS's scripting language if
you want to see strange concepts by the way) will learn R in no time.
Getting used to the commands may seem complicated at first but once
you deal with real data, which tends to be really messy, it will be
difficult to find the right menu anyway, because typically it doesn't
exist yet.
Further, as the amount of data in our area is also constantly on the
rise: From my own experience, for my master and my PhD I analyzed
whole body joint kinematics:
Master: ~216000 Data pts
PhD: ~157500000 Data pts
Today, there is just no escape from getting profficient in at least
one programming language. Might as well be R.
Anyway, I'll try the R commander over the weekend and give some
feedback.
Cheers
Rob
--- In sportsci_rtutorial@yahoogroups.com, "Will Hopkins" <will@...>
wrote:
>
> I presume folks won't mind if this interaction continues via the
list.
> Others might make some useful comments.
>
>
>
> I hadn't realized a menu-driven R was up and running. If that's
what the
> NYT article was referring to, it would imply that menu-driven R is
easier to
> use than all the other menu-driven stats packages. Is R's menu
interface any
> different from any other? Does the interface somehow capture R's
strange
> concepts/jargon for specifying data and models (which I still
haven't
> attempted to understand, I must admit)?
>
>
>
> Will
>
>
>
> From: sportsci_rtutorial@yahoogroups.com
> [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of Ian Shrier
> Sent: Friday, 9 January 2009 11:17 a.m.
> To: sportsci_rtutorial@yahoogroups.com
> Subject: Re: [sportsci_rtutorial] R article at the new york times
>
>
>
> Will
>
>
>
> Within R, there is a feature called R Commander. Once loaded, it is
> menu-driven. Further, as it runs, it writes the code so you learn
how to
> program as you go along.
>
>
>
> Unfortunately, I only learned about it after I went through the
steepest
> part of the learning curve. And although I probably should use it
sometimes,
> I tend to rely on the help documentation or my statistician friend
who is an
> R grand master...very helpful if you have one.
>
>
>
> Ian Shrier MD, PhD, Dip Sport Med, FACSM
> Associate Professor, Dep't of Fam Med, McGill University
>
> Past-President, Canadian Academy of Sport Medicine
>
> Check out: www.casm-acms.org
> SKYPE name: ian.shrier
>
> Centre for Clinical Epidemiology and Community Studies
> SMBD-Jewish General Hospital
> 3755 Cote Ste-Catherine Rd
> Montreal, Qc H3T 1E2
> Tel: 514-340-7563
> Fax: 514-340-7564
>
>
>
>
>
>
>
>
>
>
>
> On 8-Jan-09, at 4:05 PM, Will Hopkins wrote:
>
>
>
>
>
> "But R has also quickly found a following because statisticians,
engineers
> and scientists without computer programming skills find it easy to
use."
>
> This is an example of why I don't read newspapers on or off line.
>
>
>
> Will
>
>
>
> From: sportsci_rtutorial@yahoogroups.com
> [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of gerrobrein
> Sent: Friday, 9 January 2009 1:29 a.m.
> To: sportsci_rtutorial@yahoogroups.com
> Subject: [sportsci_rtutorial] R article at the new york times
>
>
>
> http://www.nytimes.com/2009/01/07/technology/business-
> computing/07program.html?_r=2
>
I
presume folks won’t mind if this interaction continues via the list. Others
might make some useful comments.
I
hadn’t realized a menu-driven R was up and running. If that’s what the NYT
article was referring to, it would imply that menu-driven R is easier to use
than all the other menu-driven stats packages. Is R’s menu interface any
different from any other? Does the interface somehow capture R’s strange concepts/jargon
for specifying data and models (which I still haven’t attempted to understand,
I must admit)?
Will
From:
sportsci_rtutorial@yahoogroups.com [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of Ian Shrier Sent: Friday, 9 January 2009 11:17
a.m. To:
sportsci_rtutorial@yahoogroups.com Subject: Re: [sportsci_rtutorial]
R article at the new york times
Will
Within R, there is a
feature called R Commander. Once loaded, it is menu-driven. Further, as it
runs, it writes the code so you learn how to program as you go along.
Unfortunately, I only
learned about it after I went through the steepest part of the learning curve.
And although I probably should use it sometimes, I tend to rely on the help
documentation or my statistician friend who is an R grand master...very helpful
if you have one.
Ian Shrier MD, PhD, Dip Sport Med, FACSM
Associate Professor, Dep't of Fam Med, McGill University
Past-President, Canadian Academy of Sport Medicine
Centre for Clinical Epidemiology and Community Studies
SMBD-Jewish General Hospital
3755 Cote Ste-Catherine Rd
Montreal, Qc H3T 1E2
Tel: 514-340-7563
Fax: 514-340-7564
On 8-Jan-09, at 4:05 PM,
Will Hopkins wrote:
“But R has also quickly found a following because statisticians,
engineers and scientists without computer programming skills find it easy to
use.”
This is an example of why I don’t read newspapers on or off line.
Within R, there is a feature called R Commander. Once loaded, it is menu-driven. Further, as it runs, it writes the code so you learn how to program as you go along.
Unfortunately, I only learned about it after I went through the steepest part of the learning curve. And although I probably should use it sometimes, I tend to rely on the help documentation or my statistician friend who is an R grand master...very helpful if you have one.
Ian Shrier MD, PhD, Dip Sport Med, FACSM Associate Professor, Dep't of Fam Med, McGill University
Past-President, Canadian Academy of Sport Medicine
Centre for Clinical Epidemiology and Community Studies SMBD-Jewish General Hospital 3755 Cote Ste-Catherine Rd Montreal, Qc H3T 1E2 Tel: 514-340-7563 Fax: 514-340-7564
On 8-Jan-09, at 4:05 PM, Will Hopkins wrote:
“But R has also quickly found a following because statisticians, engineers and scientists without computer programming skills find it easy to use.”
This is an example of why I don’t read newspapers on or off line.
“But
R has also quickly found a following because statisticians, engineers and
scientists without computer programming skills find it easy to use.”
This
is an example of why I don’t read newspapers on or off line.
Will
From:
sportsci_rtutorial@yahoogroups.com [mailto:sportsci_rtutorial@yahoogroups.com] On Behalf Of gerrobrein Sent: Friday, 9 January 2009 1:29
a.m. To:
sportsci_rtutorial@yahoogroups.com Subject: [sportsci_rtutorial] R
article at the new york times
Hi Guys,
Since we're now up and running again just a couple of admin things.
Recently, we had a few new members joining the group which made me
realize that it's probably quite tedious to download each session
individually. So I'll post an updated cumulative file containing all
previous sessions plus each according new session from now on.
Further, I was wondering whether we should switch the file format.
I've never been particular fond of the doc-format and maybe pdf files
would be more suitable anyway? However, to make it democratical
decision, I'll set up a poll where you can vote and if nobody cares
than I'll just make an executive decision in favour of pdfs.
I posted a rough timeline (under Photos) how I think the tutorial
should progress over the next couple of weeks. It's not a real
timeline since I didn't really specify time. Probably more a
succesion line. If anybody has any comments or objections please post
to the group. Again, I'll take no comments as silent approval.
Cheers
Rob
Enter your vote today! A new poll has been created for the
sportsci_rtutorial group:
Change from doc to pdf format?
o doc
o pdf
o both
To vote, please visit the following web page:
http://groups.yahoo.com/group/sportsci_rtutorial/surveys?id=2616777
Note: Please do not reply to this message. Poll votes are
not collected via email. To vote, you must go to the Yahoo! Groups
web site listed above.
Thanks!
Hi Payam,
Have a look at Session 11 dealing with factors. You have to coerce
your categorical variable into a factor. Maybe have a look at Session
3 as well. The example with aov will probably be very close to what
you want to do.
Cheers
Rob
--- In sportsci_rtutorial@yahoogroups.com, "pmahbobi" <pmahbobi@...>
wrote:
>
>
> Hi
>
> can anyone tell me how I can use dummy coding for a categorical
> predictor in regression model?
>
> I have numbers in one column and the qualitative variable in
another
> (west cost vs. east coast).
>
> how do I get R to do this for me?
>
>
> Thank you,
>
> Payam.
>
Hi
can anyone tell me how I can use dummy coding for a categorical
predictor in regression model?
I have numbers in one column and the qualitative variable in another
(west cost vs. east coast).
how do I get R to do this for me?
Thank you,
Payam.
Rob, forgot to email you that the item about your tutorials is now up
at http://sportsci.org.
Will
At 07:38 a.m. 19/11/2007 +0000, you wrote:
>Hello,
>
>This email message is a notification to let you know that
>a file has been uploaded to the Files area of the sportsci_rtutorial
>group.
Sorry guys,
Kind of really busy at the moment with starting a new job and doing
the PhD corrections. Probably won't be able to post any new tutorials
until end of september. Stay tuned though.
Cheers
Rob
Rob
Thanks for the help. This works well enough.
For the audience, I think those who use multi-relational databases might
find my problem and solution helpful.
First, I want to highlight a silly error. When trying to create a dataframe
of the date vector, I was using "as.data.frame" and this wasn't working.
Using cbind creates the matrix and coerces the date vector to a number, so
even when I converted the "numerical" date to a "date" date, I couldn't get
it into the dataframe. I then checked previous code I wrote to convert to
dataframes and the correct code is simply "data.frame" instead of
"as.data.frame".
Here is my story in more detail.
I have one table with information about injuries, including injury date, but
I don't have the enddate of the injury in that file. I have another table
with treatment dates for every subject for every injury. If I can get the
last treatment date for each injury, I can the merge this with the Injury
file and I would have all the information in one file and be able to work
from there.
So, I split the file by injuryID. This creates a list of tables. Each
component of the list is a table that has all the fields in the original
injury file but each table is limited to only one injuryId.
One can then use "lapply" to apply a function to each item in the list (i.e.
to each table). In my case, I took the last treatment in each table by using
the "tail" function.
However, using this method, the function returns a list where the name of
each component is the InjuryId and the value of each component is the last
treatment date (the class of the components is indeed date). But to merge
the information to the Injury file, I need a vector of dates associated with
the InjuryId, not a "list" of dates. So, first, I created a vector of the
InjuryId from the list using "as.numeric(names(listname))". This effectively
converts the listnames (in my case, the InjuryId) to a numeric vector. Now
came the problem I asked about.
Now, I had to get the components of the list (i.e. the actual dates) into a
vector. I then learned about "unlist", which actually worked well and
converts the components in a "list" to a vector. However, it converts the
dates to numerical vectors, just as "cbind" does. Using Rob's trick, I
simply added the number to the date 1970-01-01 and now the vector is in date
class. To link it to the InjuryId, you simply have to use
"data.frame(InjuryId,Datefield)" and it works, keeping the date in date
format (this is where I had used "as.data.frame" or "cbind" and it just kept
converting everything back to a number.
Now, I have a data.frame with InjuryId and the Lasttreatment date, and
another file with the InjuryId and all the information. The last step is to
merge the files, and the help file was pretty easy to use for that feature.
Ian
>-----Original Message-----
>From: sportsci_rtutorial@yahoogroups.com
>[mailto:sportsci_rtutorial@yahoogroups.com]On Behalf Of gerrobrein
>Sent: 19-Aug-2007 4:45 PM
>To: sportsci_rtutorial@yahoogroups.com
>Subject: [sportsci_rtutorial] Re: New file uploaded to
>sportsci_rtutorial
>
>
>Hi Ian,
>
>I have to confess that I'm not too familiar with the Date class.
>
>Anyway, from what I've picked up from the help files, Date objects are
>indeed internally represented as integers which mark the days since
>1970-01-01.
>
>Sys.Date()
>unclass(Sys.Date())
>Sys.Date() - unclass(Sys.Date())
>
>Now, concerning cbind(), the help file reads:
>The type of a matrix result determined from the highest type of
>any of the inputs in the hierarchy:
> raw < logical < integer < real < complex < character < list
>Hence, there's no cbind() function for Date objects and the objects
>are coerced to numeric. That's why you end up with numbers in your
>matrix.
>
>I guess I didn't understand the problem properly, but can't you
>include the dates straight away into your date.frame()
>
>sDate <- seq.Date(as.Date("2007/08/01"),as.Date("2007/08/30"),"4
>days")
>sDate
>injuries <- 1:8
>DF <- data.frame(date=sDate, injuries=injuries)
>DF
>
>If you have to go with cbind() what you could do, although it's not
>all too elegant and more an ad-hoc solution, you could generate a
>Date() object representing the "first" day.
>
>origin <- as.Date("1970-01-01")
>
>Generate the date matrix with cbind()
>
>dMat <- cbind(sDate,sDate)
>dMat
>
>When you need you dates back, you extract them normally from dMat and
>add them to the origin object.
>
>origin + tab[3,2]
>
>This way you end up with a Date object again.
>I suppose you're running some functions over your matrix? You could
>include this operation into this function then.
>Hope that helps. If not maybe include some generated data which looks
>like the one you're working with.
>
>Cheers
>Rob
>
>--- In sportsci_rtutorial@yahoogroups.com, "Ian
>Shrier" <ian.shrier@...> wrote:
>>
>> Rob
>>
>> I have run into a problem with manipulating a date vector. When I
>try to
>> cbind a date vector, it converts the date to a numerical vector. I
>think
>> this is because cbind creates a matrix, and matrix has to have
>numbers if I
>> remember correctly.
>>
>> I have a friend who is really good with R and he showed me that this
>> represents the number of seconds since Jan 1, 1970. He was trying
>to convert
>> it with ISOdatetime and adding the number generated by cbind. This
>converts
>> it back to a date but we couldn't get it into a dataframe.
>>
>> To take a step back so this in context, i'm working with a multi-
>relational
>> database. One table has all the injuries of athletes with the date
>of
>> injury. The other table has all the treatment dates for each
>injury. I'm
>> using a function to look at the treatment table and pull out the
>last
>> treatment date for each injury and I want to put this date into the
>> dataframe that has the list of injuries. This would give me one
>table for
>> injuries that includes the last treatment date as part of the
>table. The
>> date is then used to calculate number of days for the injury to
>heal, and
>> also will be used as the end-date when searching through a third
>table that
>> has exposures so I can count how many exposures from the injury
>start date
>> to end date.
>>
>> Any ideas?
>>
>> Ian
>>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
Hi Ian,
I have to confess that I'm not too familiar with the Date class.
Anyway, from what I've picked up from the help files, Date objects are
indeed internally represented as integers which mark the days since
1970-01-01.
Sys.Date()
unclass(Sys.Date())
Sys.Date() - unclass(Sys.Date())
Now, concerning cbind(), the help file reads:
The type of a matrix result determined from the highest type of
any of the inputs in the hierarchy:
raw < logical < integer < real < complex < character < list
Hence, there's no cbind() function for Date objects and the objects
are coerced to numeric. That's why you end up with numbers in your
matrix.
I guess I didn't understand the problem properly, but can't you
include the dates straight away into your date.frame()
sDate <- seq.Date(as.Date("2007/08/01"),as.Date("2007/08/30"),"4
days")
sDate
injuries <- 1:8
DF <- data.frame(date=sDate, injuries=injuries)
DF
If you have to go with cbind() what you could do, although it's not
all too elegant and more an ad-hoc solution, you could generate a
Date() object representing the "first" day.
origin <- as.Date("1970-01-01")
Generate the date matrix with cbind()
dMat <- cbind(sDate,sDate)
dMat
When you need you dates back, you extract them normally from dMat and
add them to the origin object.
origin + tab[3,2]
This way you end up with a Date object again.
I suppose you're running some functions over your matrix? You could
include this operation into this function then.
Hope that helps. If not maybe include some generated data which looks
like the one you're working with.
Cheers
Rob
--- In sportsci_rtutorial@yahoogroups.com, "Ian
Shrier" <ian.shrier@...> wrote:
>
> Rob
>
> I have run into a problem with manipulating a date vector. When I
try to
> cbind a date vector, it converts the date to a numerical vector. I
think
> this is because cbind creates a matrix, and matrix has to have
numbers if I
> remember correctly.
>
> I have a friend who is really good with R and he showed me that this
> represents the number of seconds since Jan 1, 1970. He was trying
to convert
> it with ISOdatetime and adding the number generated by cbind. This
converts
> it back to a date but we couldn't get it into a dataframe.
>
> To take a step back so this in context, i'm working with a multi-
relational
> database. One table has all the injuries of athletes with the date
of
> injury. The other table has all the treatment dates for each
injury. I'm
> using a function to look at the treatment table and pull out the
last
> treatment date for each injury and I want to put this date into the
> dataframe that has the list of injuries. This would give me one
table for
> injuries that includes the last treatment date as part of the
table. The
> date is then used to calculate number of days for the injury to
heal, and
> also will be used as the end-date when searching through a third
table that
> has exposures so I can count how many exposures from the injury
start date
> to end date.
>
> Any ideas?
>
> Ian
>
Rob
I have run into a problem with manipulating a date vector. When I try to
cbind a date vector, it converts the date to a numerical vector. I think
this is because cbind creates a matrix, and matrix has to have numbers if I
remember correctly.
I have a friend who is really good with R and he showed me that this
represents the number of seconds since Jan 1, 1970. He was trying to convert
it with ISOdatetime and adding the number generated by cbind. This converts
it back to a date but we couldn't get it into a dataframe.
To take a step back so this in context, i'm working with a multi-relational
database. One table has all the injuries of athletes with the date of
injury. The other table has all the treatment dates for each injury. I'm
using a function to look at the treatment table and pull out the last
treatment date for each injury and I want to put this date into the
dataframe that has the list of injuries. This would give me one table for
injuries that includes the last treatment date as part of the table. The
date is then used to calculate number of days for the injury to heal, and
also will be used as the end-date when searching through a third table that
has exposures so I can count how many exposures from the injury start date
to end date.
Any ideas?
Ian