Displaying 20 results from an estimated 1000 matches similar to: "Ragged time series data"
2011 Dec 20
1
Convert ragged list to structured matrix efficiently
Hi All,
I'm wanting to convert a ragged list of values into a structured matrix for
further analysis later on, i have a solution to this problem (below) but
i'm dealing with datasets upto 1GB in size, (i have 24GB of memory so can
load it) but it takes a LONG time to run the code on a large dataset. I
was wondering if anyone had any tips or tricks that may make this run
faster?
Below is
2004 Sep 13
1
Adding ranks to a repeatedly ragged array
How can I add an extra column containing the rank
to a ragged array indexed by more than one grouping
factors?
E.g. with the barley dataset:
How can I to add an additional column ``rank''
containing the rank of the ``yield'' of
the different varieties in relation to the indices
``year'' and ``site'' to the barley dataframe?
I achieved to calculate the ranks with:
2011 Oct 16
2
question: ragged array
Hello,
I have a big problem which I’m just not able to solve.
I created the following mean value from the following dataset structure:
Id |value
1 | 2
1 | 3
1 | 4
2 | 2
2 | 1
3 | 5
4 | 3
etc.|etc.
with the command:
mean_rating <- tapply(ratok$value, ratok$project_id , mean,simplify = FALSE)
this gives me a ragged array:
> mean_rating [1]
$`14`
2011 Jun 03
0
ragged data.frame? using plyr
I have a dataset that looks like:
set.seed(144)
sam<-sample(1000,100)
dat<-data.frame(id=letters[1:10],value=rnorm(1000),day=c(rep(1,100),rep(2,100),rep(3,100),rep(4,100),rep(5,100)))
I want to "normalise" it using the following function (unless you have
a better idea...):
adj.values<-function(dframe){
value_mean<-mean(dframe$value)
value_sd<-sd(dframe$value)
2006 Jul 19
2
Aligning ragged text columns
Can anyone please suggest how I can print:
a <- matrix(c(
"Heading 1", "This is some info\nabout heading 1",
"Heading 2", "This is some info\nabout heading 2",
), byrow=T, nrow=2)
to look like:
Heading 1 This is some info
about heading 1
Heading 2 This is some info
about heading 2
(if you're not using a fixed width
2007 Nov 24
1
ragged array with append
I wonder what's the right way in R to do the following -- placing
objects of the same kind together in subarrays of varying length.
Here's what I mean:
> word <- c("a","b","c","d","e","f","g","h","i","j")
> kind <- c(1,1,1,2,3,4,5,5,7,7)
> d <-
2001 Oct 22
1
statistics for ragged arrays: loop to vector
Dear R users,
I am currently writing a MCMC algorithm for spatial Poisson model. One
problem which I need to solve is as follows:
I have a vector X[1:J] which describes characteristics of cells of a
rectangular grid. Further, for each cell I have a list of adjascent
cells adj[] and the vector listing numbed of adjascent cells num[].
Thus if I want to list cells adjascent to cell i I write
2009 Jun 22
5
Convert "ragged" list to matrix
Hi,
I have a list made up of character strings with each item a different
length (each item is between 1and 6 strings long). Is there a way to
convert a "ragged" list to a matrix such that each item is its own row?
Here is a simple example:
a=list();
a[[1]] = c("a", "b", "c");
a[[2]] = c("d", "e");
a[[3]] = c("f",
2007 Mar 16
1
Fast lookup in ragged array
Hello,
I'm running an algorithm for graph structural cohesion that requires
a depth-first search of subgraphs of a rather large network. The
algorithm will necessarily be redundant in the subgraphs it recurses
to, so to speed up the process I implemented a check at each subgraph
to see if it's been searched already.
This algorithm is very slow, and takes days to complete on a
2008 Oct 15
2
Condition warning: has length > 1 and only the first element will be used
Hello,
I've been learning R functions recently and I've come across a problem that
perhaps someone could help me with.
# I have a a chron() object of times
> hours=chron(time=c("01:00:00","18:00:00","13:00:00","10:00:00"))
# I would like to subtract 12 hours from each time element, so I created a
vector of 12 hours (actually, more like a
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i
have their d.o.b. stored as a date in my db.
cheers
--
Posted via http://www.ruby-forum.com/.
2010 Oct 01
3
Converting a dataframe column from string to datetime
Hi,
I have a dataframe column of the form
v<-c("Fri Feb 05 20:00:01.43000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:06.34000 2010")
I need to convert this to datetime form. I did the following..
lapply(v,function(x){strptime(x, "%a %b %d %H:%M:%OS %Y")})
This gives me a list that looks like
2005 Jul 23
2
link_stat
Hi there,
I set up my company's back up server using rsync.
And I've got a strange problem. I searched in the archives of this
list, but
none of them seems not giving me an idea to solve the problem.
If anyone can help, it would be grateful.
I'm using cron by a user (non wheel/admin) to rsync everyday during
the night.
The cron is set in the server to transfer the backing-up
2007 Mar 21
1
bug and patch: strptime first-of-month error in (possibly unsupported use of) "%j" format (PR#9577)
Full_Name: John Brzustowski
Version: R-devel-trunk
OS: linux (problem under Windows too)
Submission from: (NULL) (74.101.124.238)
(This bug was discovered by Phil Taylor, Acadia University.)
I'm not sure from reading the documentation whether strptime(x, "%j") is meant
to be supported, but if so, there is a bug which prevents it from working on the
first day of months after
2007 Jan 17
2
problem with unlist POSIX date at midnight
Dear R-users,
I use unlist of POSIX dates to extract the year, hour etc. With that I
can search for files in my database which are in the form
'yyyymmddhh_synops.txt'
However, I get stucked during midnight where unlist just gives NA's.
The script is given below, the problem accurs at acc.period[16]
(midnight). However when I write out the character, unlist works well.
But
2008 Dec 11
3
getting ISO week
Hi all,
Is there a simple function already implemented for getting the ISO
weeks of a Date object?
I couldn't find one, and so wrote my own function to do it, but would
appreciate a pointer to the "default" way. If a function is not yet
implemented, could the code below be of interest to submit to CRAN?
Best Regards,
Gustaf
--------------------
2013 Dec 02
1
Days to solstice calculation
Hello,
I've come across a problem in developing a set of custom functions to calculate the number of hours of daylight at a given latitude, and the number of days a date precedes or secedes the summer solstice. I discovered an inconsistency concerning leap years between my derived values and those from the US naval databases. It seems as far as I can figure that my inconsistency arises either
2007 Dec 11
3
Wrong length of POSIXt vectors (PR#10507)
Full_Name: Petr Simecek
Version: 2.5.1, 2.6.1
OS: Windows XP
Submission from: (NULL) (195.113.231.2)
Several times I have experienced that a length of a POSIXt vector has not been
computed right.
Example:
tv<-structure(list(sec = c(50, 0, 55, 12, 2, 0, 37, NA, 17, 3, 31
), min = c(1L, 10L, 11L, 15L, 16L, 18L, 18L, NA, 20L, 22L, 22L
), hour = c(12L, 12L, 12L, 12L, 12L, 12L, 12L, NA, 12L,
2005 Oct 06
2
isdst
Can someone, please, explain the difference is results below (notice
the isdst value)
> unlist(as.POSIXlt('2005-7-1'))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 1
> unlist(as.POSIXlt(as.Date('2005-7-1')))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 0
2007 Apr 20
1
sequential for loop
Hi all,
I'm usually comfortable using the *apply functions for vectorizing loops
in R. However, my particular problem now is using it in a sequential
operation, which uses values evaluated in an offset of the loop vector.
Here is my example using a for loop approach:
dat <- data.frame(year=rep(1970:1980,each=365),yday=1:365)
dat$value <-