search for: date2

Displaying 20 results from an estimated 70 matches for "date2".

Did you mean: date
2009 Jul 11
2
Date conversions
...etimes I get NAs. That I don't understand. Can anyone see what I'm doing wrong here? As I say, I think I'd like to convert 01/03/2004 into 1040103 as this numeric format seems very good for doing comparisons. The code: MyDate1 = read.csv("C:\\Date1.txt",header=TRUE) MyDate2 = read.csv("C:\\Date2.txt",header=TRUE) MyDate1 Date1 = MyDate1$Date class(Date1) mode(Date1) Date1 Date1 = as.Date(Date1, "%m/%d/%y") class(Date1) mode(Date1) Date1 MyDate2 Date2 = MyDate2$EnDate class(Date2) mode(Date2) Date2 Date2 = strptime(Date2 + 19e6L, "%Y%m%d&quo...
2012 Nov 10
4
help on date dataset
...009 usa 40 12 27/04/2009 Mexique 26 13 27/04/2009 Canada 6 14 27/04/2009 Spain 1 15 28/04/2009 Canada 6 I want to create something like that: ? When entering two dates date1,date2 in the fuction extraction. The result must be: a new subdata with one line per date , per PAYS,per nb_pays.ILI (by summing all the number in variable nb_pays.ILI per date,per country) and the date must be between date1 and date2. I sart to do somethings like that extraction=function(date1,date...
2013 Feb 14
3
Problems plotting and regression w.r.t. date data type on x axis
Hello, probably a newbie question, but i didnt find any information on plotting/regressing w.r.t. a date data type. My trials were unfruitful. Can anyone help ? Thanks in advance! Here is my interaction with R: > tabelle date number date2 1 2009-01-1 1673 2009-01-01 2 2009-12-1 2111 2009-12-01 3 2010-7-1 2487 2010-07-01 4 2013-2-1 4301 2013-02-01 > regression.punkte<-lm(tabelle$number ~ tabelle$date2) Fehler in model.frame.default(formula = tabelle$number ~ tabelle$date2, : ung?ltiger Typ (list) f?r die Variable 'tabelle$d...
2009 Dec 07
2
Filtering a zoo object based on index of another object
...d dataset based on the measurement date of my observed data. Here, is an example similar to what I have library(chron);library(zoo) DATE<- seq(as.Date("2009-01-01"), as.Date("2009-05-01"), by = 1) mydat<- rnorm(length(DATE), 20,5) myzoo<- zoo(mydat, order.by = DATE) DATE2<- seq(as.Date("2009-01-01"), as.Date("2009-01-30"), by = 7) Now I need to create a new zoo object with index as DATE2 and corresponding data values. Any kind of help will be highly appreciated. Thanks in advance you very much -- Acharya, Subodh [[alternative HTML versi...
2011 Dec 07
2
plotting and coloring longitudinal data with three time points (ggplot2)
...gets one color and the treatment phase another? I want to be able to show how long we have been in contact with our patients, how much of the contact time that was assessment and how much that was actual treatment. Below is an example (I call it the not-working example) df2 <- data.frame( ?date2 = seq(Sys.Date(), len= 156, by="2 day")[sample(156, 78)], ?patient2 = factor(rep(1:26, 3), labels = LETTERS) ) df2 <- df2[order(df2$date2), ] dt2 <- qplot(date2, patient2, data=df2, geom="line") dt2 + scale_x_date(major="months", minor="weeks") d...
2005 Feb 24
2
Row median of Date class variables in a data frame
...ate. Below are my test data and best attempt at using apply. I didn't see a solution via Google or the Baron search site. I'd be grateful for any suggestions or solutions. I'm using R 2.0.0 on Mac OS X. Thank you, Stephen Weigand ### Test data date1 <- c(1000, 2000, 3000,4000) date2 <- date1 + 100 date3 <- date2 + 100 class(date1) <- class(date2) <- class(date3) <- "Date" test <- data.frame(date1, date2, date3) print(test) ### create a function for apply() medDate <- function(x){ obj <- unclass(unlist(x)) med <- median(obj, na.rm...
2015 Nov 06
0
Puzzled by eval
...the search list. In code sourced to the global environment, only the third of these is searched. Since base is in the second one, it is found first in the package version. Duncan Murdoch > > Terry Therneau > > > code: > joe <- function(id, data, subset, na.action, date1, date2, other.args) { > Call <- match.call() > if (!missing(data)) temp <- fred(Call) > > temp > } > > fred <- function(Call) { > # get a first copy of the id and date variables > index <- match(c("id", "date1", &quot...
2015 Nov 06
4
Puzzled by eval
...th envr and enclos arguments -- how does base end up earlier in the search path? Perhaps this is clearly stated in the docs and just not clear to me? A working solution to the dilemma is of course more than welcome. Terry Therneau code: joe <- function(id, data, subset, na.action, date1, date2, other.args) { Call <- match.call() if (!missing(data)) temp <- fred(Call) temp } fred <- function(Call) { # get a first copy of the id and date variables index <- match(c("id", "date1", "date2"), names(Call), nomatch=0) temp...
2009 Dec 09
1
reshape() makes R run out of memory (PR#14121)
Full_Name: Alexander L. Belikoff Version: 2.8.1 OS: Ubuntu 9.04 (x86_64) Submission from: (NULL) (67.244.71.200) I'm trying to reshape the following data frame: ID DATE1 DATE2 VALUE_TYPE VALUE 'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45 ... VALUE_TYPE is a string and is a factor with only 2 values (say TYPE1 and TYPE2). I need to transform it into the following data frame ("wide" transpose) based on...
2006 Dec 28
3
Dates in R
...nt me to references or provide some code on dealing with this date issue. Basically, I have two vectors of values that represent dates. I want to convert these values into a date format and subtract the differences to show elapsed time in days. More specifically, here is the example: Date1 Date2 032398 061585 032398 061585 111694 101994 111694 101994 062695 021595 051898 111597 072495 040195 072495 040195 The dates are in the mmddyy format, but when I attempt to format these in R with the function, date.mmddyy(Date1), I get very odd results. Any help on this matte...
2013 Apr 13
2
Comparison of Date format
Hi, ?In the example you provided, it looks like the dates in Date2 happens first.? So, I changed it a bit.? DataA<- read.table(text=" ID,Status,Date1,Date2 ??? ??? ?????? 1,A,3-Feb-01,15-May-01 ??? ??? 1,B,15-May-01,16-May-01 ??? ??? 1,A,16-May-01,3-Sep-01 ??? ??? ??? ??? ??? 1,B,3-Sep-01,13-Sep-01 ??? ??? ??? ??? ??? 1,C,13-Sep-01,26-Feb-04 ??? ???...
2012 May 12
1
Query regarding date as argument in functions - and about sqldf
Hi, I have a query about sqldf, and dates in general. I couldnt find much on the net or on the forums, hence I am here. Here is the issue: I want to write a function that accepts 3 arguments: date1, date2 and a dataframe, say 'df'. Within the function, I want to populate a temp dataframe which essentially contains the output of the query "select * from df where DATE between date1 and date2". DATE is a column (of class Date) which will be present in the input dataframe. This is how...
2009 Sep 11
4
Sorting
I have following object : > date2 [,1] [,2] [1,] "apr" "1992" [2,] "aug" "1992" [3,] "dec" "1992" [4,] "feb" "1992" [5,] "jan" "1992" [6,] "jul" "1992" [7,] "jun" "1992"...
2009 Jan 27
1
Mystery Error in midnightStandard
...date1 = timeDate(charvec = Sys.Date(), format = "%Y-%m-%d") date1 dow = 3; for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]), header = FALSE, na.strings=""); y = x[,1]; year = V2[[i]]; week = V3[[i]]; dtstr = sprintf("%i-%i-%i",year,week,dow); date2 = timeDate(dtstr, format = "%Y-%U-%w"); resultsdataframe$dt[[i]] <- difftimeDate(date1,date2,units = "weeks"); fp = fitdistr(y,"exponential"); print(c(V1[[i]],V2[[i]],V3[[i]],fp$estimate,fp$sd)); print(c(year,week,date2,resultsdataframe$dt[[i]])); resultsd...
2011 Aug 07
1
all.equal doesn't work for POSIXlt objects
Hi all, following sample code illustrates the problem : Date1 <- Date2 <- as.POSIXlt(seq.Date(as.Date("2010-04-01"),as.Date("2011-04-01"),by='day')) identical(Date1,Date2) all.equal(Date1,Date2) identical() gives the correct answer. As there is no all.equal method for POSIXlt objects, all.equal.list is used instead. Subsetting using...
2011 May 16
2
File to MYSQL
..."20.4"), PS = c("1014.8", "912.8", "1003", "1014.4", "967.8", "NULL"), FF_10M = c("2.91", "9.91", "1.94", "4.08", "0", "6.02" ), DD_10M = c(220, 180, 140, 180, 0, 320), date2 = c("2011051312", "2011051312", "2011051312", "2011051312", "2011051312", "2011051312" )), .Names = c("Station_NO", "TMAX_2M", "TMIN_2M", "TD_2M", "PS", "FF_10M", "DD_10M&quo...
2006 Jan 15
4
form inputs resetting on sumbit
...om dropdowns, pick a category and a report is generated.) <%= start_form_tag :action => ''display_report'' %> From: <%= date_select ''report'', ''date1'' %> <br /> To: <%= date_select ''report'', ''date2'' %> <br /> Category: <%= select(:report, :category_id, @categories) %><br /> <%= submit_tag ''Show Report'' %> <%= end_form_tag %> When I submit this form (back to the same action) all of the dropdowns are reset to default values, inst...
2017 Jun 21
0
Help/ Mathematics
Hi Ahmed, Your problem appears trivial as you have already specified the form of the calculation. Learn how to "extract" specified elements from a data structure: # first value sum(dataset1$NPP[dataset1$date >= date1 & dataset1$date <= date2]) # second value dataset2$biomass[dataset2$date == date2] - dataset2$biomass[dataset2$date == date1] # third value dataset3$littfall[dataset3$date == date2] Note that you may have to convert character strings to dates to do the above - see a function like "as.Date". Obviously I do not k...
2012 Mar 07
1
date columns chooser
i have a data frame with 2 columns of dates. with str(dataframe) i have ensured myself that they were indeed formatted as dates. one column has NA's in it. the aim is now to make a third column that chooses date1 if it is a date, and choose date2 if it is a NA. i am trying df$date3=ifelse(is.na(df$date1), df$date2, df$date1). this leads to unexpected behaviour: the resulting column is numeric, and shows numbers like 16000. i have no idea what this is and how to solve it? henk [[alternative HTML version deleted]]
2009 Dec 04
0
simple reshape of a large data frame (reshape() runs out of memory)
Hello everyone, I'm having a problem performing reshape() on a large data frame. The operation is fairly trivial but it makes R run out of memory. The data frame has the following structure: ID DATE1 DATE2 VALTYPE VALUE 'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45 ... VALTYPE is a string and is a factor with only 2 values (say TYPE1 and TYPE2). I need to transform it into the following data frame ("wide" transpose) based on common ID and DA...