Displaying 20 results from an estimated 10000 matches similar to: "Keep date, strip time?"
2009 Jul 02
4
Name of data.frame as a text string?
I've passed a data.frame as an input into a function which does some
plotting on a 4x4 matrix of certain parameters within in the
data.frame. I'd like to add a small header on top of each plot with
the name of the data.frame so that it's clear as I compare these 16
things where each on came from.
So far I haven't found the right way to get the name of the data.frame
as a string
2011 Feb 01
3
R string help
Dear R guru:
If I got a variable
aaa<- "up.6.11(16)"
how can I extract 16 out of the bracket?
I could use substr, e.g.
substr(aaa, start=1, stop=2)
[1] "up"
But it needs start and stop, what if my start or stop is not fixed, I
just want the number inside the bracket, how can I achieve this?
Many thanks
yan
2010 Dec 15
2
Cumulative percentage by unit of time
Hi All,
I've been struggling on that one for a couple of days. I've tried several
things, but nothing is worth publishing.
I'm working with a bird nests data frame for which I have a laying date (LD)
and a fledgling date (FD) (in calendar Julian date) by nest id. For the
period spanning between LD and SD, the nest is termed "active". Each nest id
occur once in the data
2009 Dec 07
3
Regular expression help
Hi there
I have a string like this i want to extract 9831019 from this string i used
a regular expresion \d+ by which i can only make it to see 7 and returns.
This type of number(9831019) appears in any part of the string and is
definitely more than 5 digits all the time and i want to give that as a
condition
UV7C11-F9-E1 MCS#9831019
MCS Lot #9512516"
how do i go abt it
Ramya
--
View
2009 Sep 18
1
lapply - value changes as parameters to function?
Hi,
I'm trying to get better at things like lapply but it still stumps
me. I have a function I've written, tested and debugged using
individual calls to the function, ala:
ResultList5 = DoAvgCalcs(IndexData, Lookback=5,
SampleSize=TestSamples , Iterations=TestIterations )
ResultList8 = DoAvgCalcs(IndexData, Lookback=8,
SampleSize=TestSamples , Iterations=TestIterations )
ResultList13
2005 Jul 19
2
Problems with date-format (R 2.1.1 + chron)
Hello,
today I've updated on the newest R-Version. But sadly a function I needed
didnt want to work:
The input is e.g.
days(as.Date("21-07-2005","%d-%m-%y"))
the error is: Fehler in Math.Date(dts): floor nicht definiert f??r Date
Objekte
(Error in Math.Date(dts): floor not defined for date objects)
Same for year. Only months gives me the correct output.
In Version
2010 Mar 15
1
problem in reading trajectory file
Hi,
I'm trying to read some trajectory files (text files) which have the form:
# trial n
# t X Y
0 1 2
0.2 1 3
0.4 1.2 4
...
# trial n+1
# t X Y
0 1 2
0.2 1.3 3.3
0.4 1.5 5
...
...
where the symbol # means that the line is not a numeric value, but I still
need to read the number of the trial (n=1, 2, etc.).
I
2011 May 24
2
Extracting day of month from Date objects
I've always found the chron library to be useful for
tasks like this:
> x <- round(runif(10)*100000, digits=0)
> y <- as.Date(x, origin="1970-01-01")
> library(chron)
> days(y)
[1] 7 25 26 25 10 24 1 31 12 8
31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < ... < 31
Notice that it returns the days as
2012 Dec 08
2
Why my lapply doesn't work with FUN=as.Date
Hi, guys
I don't understand why I can apply as.Date to a single item in the list:
> as.Date(alldays[4])
[1] "29-03-20"
but when I try to lapply as.Date to all the items, i got a sequence of neg
numbers:
> sapply(alldays[1:4], FUN=as.Date)
03-04-2012 02-04-2012 30-03-2012 29-03-2012
-718323 -718688 -708492 -708857
does anyone know what's wrong here?
i am
2001 Jan 11
3
Reformatting dates using chron
Hello All:
I am trying to generate a sequence of dates using library(chron). Using the following code, I got most of what I want,
dts <- seq.dates("01/02/1998", "01/10/2001", by="day")
dts <- dts[!is.weekend(dts)]
a sequence of weekdays only (no weekend dates), with first observation appearing as 01/02/98 and the last 01/10/01. But I would
2005 Apr 15
2
aggregate slow with variables of type 'dates' - how to solve
Dear all
I use aggregate with variables of type numeric and dates. For type numeric
functions, such as sum() are very fast, but similar simple functions, such
as min() are much slower for the variables of type 'dates'. The difference
gets bigger the larger the 'id' var is - but see this sample code:
dts <- dates(c("02/27/92", "02/27/92",
2009 Aug 28
2
new data.frame summed by date
Hi,
I wonder if someone can suggest how to create a new data.frame Y
from X where X$PL_Pos is summed by each unique X$MyDate. Y should end
up with two (or more) columns Y$MyDate and Y$PL_Sum with its value
being the cumsum of all the values in X for that date. - a 'daily
cumsum'.
Thanks,
Mark
TStoDate = function (TSDate) {
X = strptime(TSDate + 19e6L, "%Y%m%d")
2010 Mar 23
3
Converting date format
R community:
Hello, I would to like to convert a character date variable from %m/%d/%Y to %m/%d/%y. Any advice would be greatly appreciated. I have tried functions for changing the formatting and removing the unnecessary digits without success.
Mike
2009 Sep 20
2
Date/Time to date & time
Hi,
Can strptime (or some other function) help me turn the following
column of a data.frame into two new columns, one as date and the other
as time, preserving the AM/PM value?
Thanks,
Mark
> B
ENTRY DATE
1 3/23/2009 6:30:00 AM
2 3/23/2009 6:30:00 AM
3 3/23/2009 6:39:00 AM
4 3/23/2009 6:39:00 AM
5 3/23/2009 6:48:00 AM
6 3/23/2009 6:48:00 AM
7 3/23/2009 7:00:00 AM
2010 Oct 29
7
date calculation
Hi list,
Could someone explain to me why the following result is not a integer?
> difftime(strptime("24NOV2004", format="%d%b%Y"), strptime("13MAY2004",
>format="%d%b%Y"), units="days")
Time difference of 195.0417 days
I'm using R2.12.0 on WinXP.
Thanks!
...Tao
2017 Nov 14
1
Dates to numeric in for loop
Hi
Can anyone explain why a date becomes numeric when you loop over a series
of dates?
> dt <- Sys.Date()
> dt
[1] "2017-11-14"
> class(dt)
[1] "Date"
> dts <- dt - 1:0
> class(dts)
[1] "Date"
>
> for (i in dts) {
+ print(i)
+ print(class(i))
+ print(as.Date(i, "1970-01-01"))
+ print(class(as.Date(i,
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of
dates. Following the example in Spector ("Data Manipulation in R"), I
create a date
> mydate = as. POSIXlt('2005-4-19 7:01:00')
I then successfully extract the day with the command
> mydate$day
[1] 19
But when I try to extract the month
> mydate$mon
[1] 3
it returns the wrong month. And
2014 May 07
4
[Bug 926] New: icmp: ICMPv6 types are not supported
https://bugzilla.netfilter.org/show_bug.cgi?id=926
Summary: icmp: ICMPv6 types are not supported
Product: nftables
Version: unspecified
Platform: x86_64
OS/Version: Debian GNU/Linux
Status: NEW
Severity: normal
Priority: P5
Component: nft
AssignedTo: pablo at netfilter.org
ReportedBy:
2008 Dec 18
3
Parsing unusual date format
Hello,
If I have a character string like
d <- c("1990m3", "1992m8") #March 1990 and Aug 1992
what is the easiest way to convert it into any standard date form; for
example,
d <- c("01/03/1990", "01/08/1992")
I looked at as.Date but it doesn't seem to address my problem as I have an
"m" stuck in the middle of my character string
2011 Feb 07
2
Using Aggregate for Date
Hi,
I am trying to find the min of day for each student in each year.
Here is the dataset:
date studentid year
1/1/05 6:07 AM 236 20082009
3/27/09 9:45 AM 236 20082009
4/29/09 8:44 AM 236 20082009
3/27/09 11:36 AM 310 20082009
4/1/09 10:43 AM 310 20082009
10/15/09 8:54 AM 310