similar to: Weird issue when iterating through dates

Displaying 20 results from an estimated 30000 matches similar to: "Weird issue when iterating through dates"

2015 Aug 12
2
Weird issue when iterating through dates
I am not sure if this is a bug or not. Gabor On Wed, Aug 12, 2015 at 11:51 AM, Luca Cerone <luca.cerone at gmail.com> wrote: > Following up on this, should I report a bug? can you drive me through > the process? > > Cheers, > Luca > > On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap <wdunlap at tibco.com> wrote: >>>> Just a quick question: what's
2015 Aug 06
2
Weird issue when iterating through dates
Thanks G?bor, I thought there was some mistake in my logic on how casting works in R and wanted to be sure. Just a quick question: what's the difference between `[.Date` and `[[.Date`? Is it supposed to be the method for accessing the value right? Thanks again for your help, Cheers, Luca On Thu, Aug 6, 2015 at 10:10 AM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > Date has a
2015 Aug 06
0
Weird issue when iterating through dates
Date has a `[.Date` method and also `[[.Date`, but it looks like a for loop does not consider the class of the object you are iterating over, so these are ignored and the internal representation is used. I think this is a bug, at least in the documentation of ?"for". Interestingly, lapply and co. do consider the class: invisible(lapply(seq(d1, d2, by = 1), print)) works as you would
2015 Aug 06
2
Weird issue when iterating through dates
>> Just a quick question: what's the difference between `[.Date` and `[[.Date`? >> Is it supposed to be the method for accessing the value right? > >For Dates and atomic vectors in general they are the same, but ... Even for atomic vectors with names they are not quite the same > c(One=1, Two=2)[[2]] [1] 2 > c(One=1, Two=2)[2] Two 2 (and [[ will
2015 Aug 12
0
Weird issue when iterating through dates
On Wed, Aug 12, 2015 at 10:55 AM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > I am not sure if this is a bug or not. > I would argue that this isn't a bug, not even in the documentation of "for" (even though it might be clearer). ?"for" says that `seq` is "[A]n expression evaluating to a vector (including a list and an expression) or to a pairlist or
2008 Apr 09
2
fuzzy merge
Hi, I would like to merge two data frames. It is just that I want the merging to be done with some kind of a fuzzy criterion. Let me explain. My first data frame looks like this : ID1 time1 dt 1 2008-01-02 13:11 10 2 2008-01-02 14:20 20 3
2009 Jun 04
1
Morlet wavelet analysis
Dear, I am using "cwt "function from Rwave package to perform Morlet wavelet analysis. d1<-c(1.31673209591515, -0.171333455797346, -1.67618546079420, -0.931604651010362, -0.954614183224057, -1.19821794547758, 0.516096363353144, -0.0432811977638559, 0.737764943619919, 0.438046629673177, -0.208607167908743, -0.3091308821262, -1.42473112931594, 0.234125312118165, -0.307047554490597,
2009 Mar 06
2
How to apply a function to slices of multidimensional arrays, and not just iterating through single elements
Hello, If I want to apply some f(x) to such chunks of the the array dim(A)==c(d1,d2,d3,..,dk,...,dn) which are defined by A[...,ik,...] (ik belongs to {1,..,dk}), for now I use iteration via 'for (i in dim(A)[k]) f(A[...,k,...])' . Is there any more elegant approach, e.g like in 'apply' function which you can use on margin of the array. Just in my case I want the entire slice
2010 May 26
2
Avoiding Loops When Iterating Over Statement That Updates Its Input
Since `for' loops are slow in R, and since `apply' functions are faster, I was wondering whether there were a way to use an apply function?or to otherwise avoid using a loop?when iterating over a statement that updates its input. For example, here's some such code: r.seq <- 2 * (1 / d$Dt[1] - 1) for (i in 2:nrow(d)) { rf <- uniroot(bdt.deviation, interval=c(0, 1),
2010 Sep 14
3
extracting objects from lists
If you have 5 data frames and you append them to a list, how do you access the first data frame, not the first value of the first data frame while iterating in a for loop? list = c(d1,d2,d3,d4,d5) where d1..d5 are dataframes. for(i in 1: length(list)){ print(list[1]) } -- View this message in context: http://r.789695.n4.nabble.com/extracting-objects-from-lists-tp2539412p2539412.html Sent from
2009 Oct 10
2
Matching Dates Closest without going over
Hi, I have 2 date vectors d1 and d2. d1 <- structure(c(14526, 14495, 14464, 14433, 14402, 14371, 14340, 14309, 14278, 14247, 14216, 14185), class = "Date") d2 <- structure(c(14526, 14509, 14488, 14466, 14453, 14441, 14396, 14388, 14343, 14333, 14310, 14281), class = "Date") I would like to create another dataframe with columns d1 and d2, where d1 is the original d1
2020 Jun 16
1
Voice "broken" during calls
On Tuesday 16 June 2020 at 08:18:51, Luca Bertoncello wrote: > > sudo tcpdump -i eth0 -s 0 -w /tmp/test0.pcap & > > sudo tcpdump -i eth1 -s 0 -w /tmp/test1.pcap & > > eth0 is my DSL interface and eth1 my phone interface? Well, one is internal (phone) and the other is external (DT), doesn't matter which way round. > tcpdump -i dsl0 -s 0 -w /tmp/test0.pcap host
2024 Jan 11
4
arrow on contour line
Hello, I am drawing contour lines for a function of 2 variables at one level of the value of the function and want to include a small arrow in any direction of increase of the function. Is there some way to do that? Below is an example that creates the contour lines. How do I add one small arrow on each line in the direction of increase of the function (at some central point of the contour
2013 Mar 09
1
Unexpected behavior looping through sequence of dates
I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric: > date1 = "20130301" > date2 = "20130302" > > d1 = as.Date(date1, format="%Y%m%d", tz="GMT") > d2 = as.Date(date2,
2010 Jun 21
2
difference in dates
Dear R People: I have a data frame with the two following date columns: > a.df[1:10,c(1,6)] DATE DEATH 1207 2009-04-16 2009-05-06 1514 2009-04-16 2009-05-06 2548 2009-04-16 2009-05-08 3430 2009-04-16 2009-05-09 3851 2009-04-16 2009-05-09 3945 2009-04-16 2009-05-09 7274 2009-04-16 2009-05-12 7532 2009-04-16 2009-05-12 7651 2009-04-16 2009-05-12 8495 2009-04-16 2009-05-13 >
2009 Feb 22
2
how to recover a list structure
I am experiencing some problems at working with lists at high level. In the following "coef" contains the original DWT coefficients organized in a list. Thorugh applying the following two commands: coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs) coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE) I get vector "coef.abs.sorted" containing
2008 Jun 03
3
How to solve a non-linear system of equations using R
Dear R-list members, I've had a hard time trying to solve a non-linear system (nls) of equations which structure for the equation i, i=1,...,4, is as follows: f_i(d_1,d_2,d_3,d_4)-k_i(l,m,s) = 0 (1) In the expression above, both f_i and k_i are known functions and l, m and s are known constants. I would like to estimate the vector d=(d_1,d_2,d_3,d_4) which is solution
2011 Apr 16
1
Matching Problem: Want to match to data.frame with inexact matching identifier (one identifier has to be in the range of the other).
Hello R-Community, I have the following matching problem: I have two data.frames, one with an observation every month (per company ID), and one with an observation every quarter (per company ID; note that quarter means fiscal quarter; therefore 1Q = Jan, Feb, Mar is not necessarily correct and also, a fiscal quarter is not necessarily 3 month long). For every month and company, I want to get the
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries (Python lingua) as S4 classes, see the coding below. I came across some rough S4 edges, but in the end it worked (for one dictionary). When testing ones sees that the dictionaries D1 and D2 share their environments D1 at hash and D2 at hash, though I thought a new and empty environment would be generated each time
2003 Jul 30
3
nested for() loops for returning a nearest point
I'm trying to do the following: For each ordered pair of a data frame (D1) containing longitudes and latitudes and unique point IDs, calculate the distance to every point in another data frame (D2) also containing longitudes, latitudes and point IDs, and return to a new variable in D1 the point ID of the nearest element of D2. Dramatis personae (mostly self-explanatory): D1$long