[R] function completing properly

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Jul 10 02:27:16 CEST 2014


I think you are mistaken. Please provide an example of how you used this function in any version of R that behaved as you describe.
Also, please post in plain text to avoid the what-you-see-is-not-what-we-see feature that HTML email provides.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On July 9, 2014 4:47:39 PM PDT, Janet Choate <jsc.eco at gmail.com> wrote:
>Hi R community,
>i created a function (mkdate) as follows:
>
>mkdate = function(x) {
>x$date = as.Date(paste(x$year, x$month, x$day, sep="-"))
>x$wy = ifelse(x$month >=10, x$year+1, x$year)
>x$yd = as.integer(format(as.Date(x$date), format="%j"))
>x$wyd = cal.wyd(x)
>x
>}
>
>the function results in adding the new columns date, wy, yd, and wyd to
>the
>table i apply it to.
>this has always worked in R version 2.14.2.
>however, in R version 3.1.0 - instead of my mkdate function adding
>those
>columns to my existing table, it just overwrites my table and leaves me
>with just a list of the last variable created by my mkdate function. so
>i
>end up with just a list of numbers representing wyd, and lose all the
>data
>in my original table.
>
>does anyone know what would now be causing this to occur, and what i
>need
>to do to make my function work properly again?
>
>thank you for any assistance,
>Janet
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>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.



More information about the R-help mailing list