Displaying 20 results from an estimated 10000 matches similar to: "subtract a specified number of days from current date"
2012 Apr 30
1
Subtract days to dates in POSIXct format
Hello,
I'm having problems working with date values in POSIXct format. Here is what I got (eg.lig attached):
x <- read.table("eg.txt", sep = ',', col.names=c("ok","time","secs","lig")) # it gives time as factor
z <- cbind(x,colsplit(x$time, split="\\s", names=c("date", "clock")))
2012 Mar 15
1
Subtract Date Between columns
Hello
I have this little dataset, my goal is create one column in the
data.frame with between the diference DataTime and Duration.
I'm using the next code to make do this
TIME_STAMP SESSIONTIME Time TimeStart
1162343932 8320 2006-10-31 19:01:34 2006-10-31 16:42:54
1162343215 592 2006-10-31 19:02:04 2006-10-31 18:52:12
1162341465 11875
2012 Oct 30
3
subtract a time period from a date
Hello everybody,
how can I reduce e.g. 30 days from a date?
When I do the following "2011-05-01 CEST" -"2011-04-01 CEST" I get:
"Time difference of 30 days"
an thats fine.
But when I try "2011-05-01 CEST" - 30 I get nonsense.
So how can I subtract some days, month or years from a date?
thanking you in anticipation
Claudia Paladini
2011 May 23
2
days between dates
Hello, I have some unbalanced panel data that is measured on weekdays only
(i.e., excluding Saturday and Sunday). I would like to get the number of
days between dates such that the number of days between a Friday and a
Monday is 1 (and not 3). Here is some code to illustrate my problem:
library('Hmisc');
DATE <-
2012 Jul 11
3
unable to subtract dates in R
Hi,
I wanted to calculate the age of people in my dataset by subtracting the
individual's date of birth from their intake into a program.
After several hours, searches of help archives, and the downloading of
lubiridate, I have had no luck with this.
Below is the code I used.
> intakeDS$DOB <- as.character(intakeDS$DOB)
> intakeDS$DOB <- as.Date(intakeDS$DOB,
2004 May 26
2
Subtracting number of days from a date
Hi group,
suppose I have a date, say May 15 2004, and I want to now what date it is 23 days before that date. The way to calculate the new date should (...) take account of leap years :)
In pseudocode:
olddate <- "May 15 2004"
newdate <- olddate-23
I looked around in POSIXct etc..., maybe I overlooked?
Thanks,
Maarten
2002 Feb 22
1
Weekdays
Hello,
I'm trying to write a function that returns the number of weekdays between a
vector of start dates and a vector of end dates.
Subtracting the 2 times the number of whole weeks is the easy part and works
if the number of days is a multiple of 7.
However, the number of weekend days in the tail is a little harder. It
depends on both the start date of the tail and the number of days in
2012 Jun 30
3
How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)
Hello,
I'd have a time series, where I am plotting the means and sd of a distance
for a variety of positions along a bird's bill. I'd like to set each line
(represented by "point") to start at zero, so that I can look at the
absolute change along the series. At the moment I only know how to do that
in Excel, by subtracting the value of time 1, point 1 from all other times
2010 Aug 05
3
Date conversion
Hi all,
I am trying to convert all the dates (all days that are not Friday) in data
frame into dates to next Friday.
The following works but the result is returned as vector rather than the
original class.
It would be greatly apprecited if you could provide any solution to this
problem.
Many thanks in advance.
# Define arbitrary initial date value
ini <- as.Date("2010/1/1",
2013 Sep 10
1
Subtracting elements of a vector from each other stepwise
I am trying to figure out how to create a loop that will take the
difference of each member of a vector from each other and also spit out
which one has the least difference.
I do not want the vector member to subtract from itself or it must be able
to disregard the 0 obtained from subtracting from itself.
For example:
x = c(17,19,23,29)
1. abs(x-x[1]) = (0, 2, 6, 12)
2. abs(x-x[2]) = (2, 0,
2009 Mar 19
1
subtract values
Dear R-help
I am using R version 2.6.2. I am trying to subtract specific values from a larger data frame. I feel this should be straightforward, but I am struggling.
I have a dataframe "Bk" as follows:
DateTime cumPrecip
01/01/2008 00:00 348
01/01/2008 01:00 348
01/01/2008 02:00 348
01/01/2008 03:00 347
01/01/2008 04:00 348
01/01/2008 05:00 348
01/01/2008 06:00 349
2008 Apr 10
2
subtract the mean from each column
Hi,
I am new to R an dI need some help
I have a matrix of real values 100*300 and I would like to calculate the
mean for each column , then for each entry in a column i need to subtract
the mean so I will have a matrix where the columns have zero mean. any one
know how to do that . Thanks
--
View this message in context:
2011 Jul 27
2
Elegant way to subtract matrix from array
there are really two related problems here
I have a 2D matrix
A <- matrix(1:100,nrow=20,ncol =5)
S <- matrix(1:10,nrow=2,ncol =5)
#I want to subtract S from A. so that S would be subtracted from the
first 2 rows of
#A, then the next two rows and so on.
#I have a the same problem with a 3D array
# where I want to subtract Q for every layer (1-10) in Z
# I thought I solved this one
2008 Jan 29
2
add/subtract matrices, ignoring NA or missing values
Hi,
For example, given two 2x2 matrices m1 and m2. I would like to add/subtract
element by element
> m1
[,1] [,2]
[1,] NA NA
[2,] 1 2
> m2
[,1] [,2]
[1,] 1 NA
[2,] NA 2
> m1 + m2
[,1] [,2]
[1,] NA NA
[2,] NA 4
How can I ignore the NA, and get this ? Hope the solution can be extended to
subtract and modulo also.
[,1] [,2]
2012 Mar 29
2
subtract a list of vectors from a list of data.frames in an elegant way
Dear R experts,
I've realized that it might not be possible to define a negative SELCET statement in a SQL call so now I'm looking for the smoothest way to generate a list of what I would like from my large database by first pulling all the names with a query like this "SELECT top 1 * FROM your_table" (thank you Bart Joosen for the idea) and then subtract the variables I am not
2012 Nov 18
0
subtract multiple columns from single column for Nash Sutcliffe efficiency
Hi everyone, I am having trouble using my own data in the Nash-Sutcliffe
efficiency (NSE) function.
In R, this is what I have done:
Vobsr <- read.csv("Observed_Flow.csv", header = TRUE, sep =",") # see data
below
Vsimr <- read.csv("1000Samples_Vsim.csv", header = TRUE, sep =",") # see
data below
Vobsr <- as.matrix(Vobsr[,-1]) # remove column 1
2008 May 07
3
use list elements to subtract values from the dataframe
Hi,
I have a dataframe wf existing of a header with different labels and beneath
the values of those labels :
wf:
label1 label2 ...
0,45 0,21
0,10 0,45
.... ....
I have a list
fl <- c("label2","label3",..)
Isn't possible to use the list elements in the list in order to subtract
values from the dataframe? like :
wf$fl[[1]]
When I do in R I get :NULL
2011 May 25
1
Subtracting rows by id
Dear R users,
I have two datasets:
id1 <- c(rep(1,10), rep(2,10), rep(3,10))
value1 <- sample(1:100, 30, replace=TRUE)
dataset1 <- cbind(id1,value1)
id2 <- c(1,2,3)
subtract.value <- c(1,3,5)
dataset2 <- cbind(id2, subtract.value)
I want to subtract the number of rows in the subtract.value that
corresponds to the id value in dataset1. So for the 1 in id1, I want
to
2008 Oct 13
1
cut.Date problem when starting on first day of week (PR#13159)
Apparently any (?) call of the form
cut(date,"weeks")
where the date *begins the week*, gives the error
Error in 1:(1 + max(which(breaks < maxx))) :
result would be too long a vector
In addition: Warning message:
In max(which(breaks < maxx)) :
no non-missing arguments to max; returning -Inf
To my surprise, this was first reported as a problem in 2006 (!)
(version 2.3.1
2010 Feb 19
1
Subtracting one based on an If
For the following:
Bldgid<-c(1000,1000,1000,1001,1002,1003,1003,1003)
Maplot<-c(20000,20001,20002,30000,30001,40000,40001,40002)
Area<-c(40,170,160,50,100,100,90,110)
#Construct Sample dataframe
MultiLotBldgs..<-data.frame(Bldgid,Maplot,Area)
CondoLots_ <- tapply(MultiLotBldgs..$Maplot, MultiLotBldgs..$Bldgid, length)
CondoLots_ Returns:
1000 1001 1002 1003
3 1 1