Re: [R] Function that create day of the year column.

2014-11-05 Thread Jeff Newmiller
Beware of Sys.Date, since it returns GMT, so depending on your local timezone you may be surprised by the result. I prefer to explicitly set the TZ environment variable and use Sys.time to get local time. You can use trunc() to chop off the time part.

Re: [R] Function that create day of the year column.

2014-11-05 Thread MacQueen, Don
I would start with this example, which is available from base R, without additional packages, to help understand the suggestions that follow. > unclass(as.POSIXlt(Sys.Date())) $sec [1] 0 $min [1] 0 $hour [1] 0 $mday [1] 5 $mon [1] 10 $year [1] 114 $wday [1] 3 $yday [1] 308 $isdst [1] 0 at

Re: [R] loops in R

2014-11-05 Thread Berend Hasselman
On 05-11-2014, at 14:41, Noha Osman wrote: > Hi Folks > > Iam a new user of R and I have a question . Hopefully anyone help me in that > issue > > > I have that dataset as following > > Sample Population Species Tissue R GB > 1 Bari1_062-1 Bari1 ret

Re: [R] loops in R

2014-11-05 Thread Steve Lianoglou
While you should definitely read the tutorial that Don is referring to, I'd recommend you take a different approach and use more R idiomatic code here. In base R, this could be addressed with few approaches. Look for help on the following functions: * tapply * by * aggregate I'd rather rec

Re: [R] loops in R

2014-11-05 Thread Daniel Nordlund
On 11/5/2014 5:41 AM, Noha Osman wrote: Hi Folks Iam a new user of R and I have a question . Hopefully anyone help me in that issue I have that dataset as following Sample Population Species Tissue R GB 1 Bari1_062-1 Bari1 ret seed 94.52303 80.7

Re: [R] loops in R

2014-11-05 Thread Don McKenzie
Have you read the tutorial that comes with the R distribution? This is a very basic database calculation that you will encounter (or some slight variation of it) over and over. The solution is a few lines of code, and someone may write it out for you, but if no one does You have 20 population

[R] Function StructTS: covariance matrix of the initial state vector

2014-11-05 Thread Javier López-de-Lacalle
Hi everyone: My question is about the function "StructTS" of the core package "stats", which fits by maximum likelihood the basic structural time series model. According to theory and the references given in "?StructTS", the covariance matrix of the initial state vector is a diagonal matrix. Ho

[R] loops in R

2014-11-05 Thread Noha Osman
Hi Folks Iam a new user of R and I have a question . Hopefully anyone help me in that issue I have that dataset as following Sample Population Species Tissue R GB 1 Bari1_062-1 Bari1 ret seed 94.52303 80.70346 67.91760 2 Bari1_062-2 Bari1

[R] better two column output from rmarkdown

2014-11-05 Thread Bos, Roger
Disclaimer: This question is more about HTML than R, but since I am using rmarkdown, I am not sure of a better forum to ask this. The code example below produces two column HTML output. If you run the example you will see that the "" paragram starts off at the bottom of the first column an

Re: [R] cluster + tt terms in coxph

2014-11-05 Thread Therneau, Terry M., Ph.D.
This is fixed in version 2.37-8 of the survival package, which has been in my "send to CRAN real-soon-now" queue for 6 months. Your note is a prod to get it done. I've been updating and adding vignettes. Terry Therneau On 11/05/2014 05:00 AM, r-help-requ...@r-project.org wrote: I am receiv

[R] Differences between MTDFReml and kinship2

2014-11-05 Thread silvano
Hi, I fitted a genetic model using kinship2 and I compared it with MTDFReml program output. The residual variance of both are very close but the genetic variance are very differents. The output are: MTDFReml: genetic variance = 1.24015 residual variance = 5.93424 R (Kinship2): genetic varian

[R] Fwd: Re: Function that create day of the year column.

2014-11-05 Thread Michael Dewey
Dear Federic You need to do something like function(p, weights = NULL, data = NULL, subset = NULL, na.action = na.fail) { # but you will have Day, Month, Year, data # instead of the first three if(is.null(data)) data <- sys.frame(sys.parent()) mf <- match.call() mf$data <- NULL mf

Re: [R] Function that create day of the year column.

2014-11-05 Thread PIKAL Petr
Hi single date and vector of dates is something quite different. Your bithday is single date, birthdays of country population is vector of dates. You want to check that some columns in your data are those you want directly inside the function? Or you just want to be able to select columns on y

Re: [R] Function that create day of the year column.

2014-11-05 Thread Frederic Ntirenganya
Dear PIKAL, I am using a data frame not a single value. I wanted to add a new column "DOY" on a dataset. I made it but I want to make it General. i.e. You will see in the dataset I am using columns names (Year,month and day.) What if I have this information in other columns names? In this function