I'm trying to join a data.table with me. The condition used to reach the matrix is the condition of joining the value of the column (not the key). Each line has a date (in seconds) and the record is only the latest record (t1
cn & lt; -unique (sdd $ column) mat; lt; -matrix (data = 0, nrow = lde, ncol) = Lde), Dimnames = list (cn, cn))
I have documented frequently asked questions (including SQL for qualified analogy with data) and datatable and many similar questions I'm struggling with the beginner's guide. In this forum but I can not get it to solve.
,
I stuck with signaling problems.
My DT is sdd:
I have made several attempts such as: > / p>
sdd2 & lt; Avoid problems with the names of variables -sdd # [sdd2 SDD, eqXrossM [cbind (sdd.EquipmentID, sdd2.EquipmentID)] == 1 & amp; Sdd.DelayEndTimeSeconds & LT; Sdd2. DelayStartTimeSeconds, Distance: = sdd.DelayEndTimeSeconds-sdd2.DelayStartTimeSeconds] [, Distance: = sdd.DelayEndTimeSeconds & LT; Sdd2.DelayStartTimeSeconds] # will be the whole thing to create a new column with time difference difference SDD [sdd2 [sdd.DelayEndTimeSeconds & LT; Sdd2.DelayStartTimeSeconds, Distance: = sdd.DelayEndTimeSeconds & LT; Sdd2.DelayStartTimeSeconds]] #this is an approximation attempt.
I do not get the signal only, and different examples use different notations.
EDIT: Okay, after a night of sleep some things are going to understand ... but others are still just one misleading. For example:
sdd_x & lt; -sdd [sdd2, i.DelayStartTimeSeconds & gt; DelayEndTimeSeconds] # returns a vector as SDD: lane sdd_x & lt; -sdd [sdd2, i.DelayStartTimeSeconds & gt; DelayEndTimeSeconds & amp; EXXrossM [i.EquipmentID, Tool ID] == 1] # Returns Matrix Lane X Lane.
Why does the type of change change in a new situation? I was expecting a case like a matrix (which requires optimization) apart from this, the entire matrix is false, which is not expected as a record value. For the second case, either the upper or lower diagonals should be TRUE.
In addition to this, the matrix does not need to use the cibind like the call as it is mentioned in the form of the second answer to the same question.
And my last search is searching for the CJ () operator but I am trying to use it. The signaling does not work here. This part does not seem to be documented too.
SDD [CJ (DASDelayID, DASDelayID), i.DelayStartTimeSeconds & gt; DelayEndTimeSeconds].
Any help would be appreciated
In this way I After all, I resolve the problem:
sddx & lt; & Lt; -CJ (ID1 = sdd $ DASDelayID id2 = SDD $ DASDelayID) [ID1 to & lt; Id = 2] [, ': =' (connect = eqXrossM [cbind (SDD [DASDelayID == ID2, EquipmentID], SDD [DASDelayID == ID1, EquipmentID])] == 1, distance = as.integer (SDD [ DASDelayID == ID2, DelayStartTimeSeconds] -sdd [DASDelayID == ID1, DelayEndTimeSeconds])]
Step-by-Step:
Generate all combinations of DelayID, The number is too large, but each row has only two column integers
sddx. & Lt; & Lt; -CJ (ID1 = SDD $ DASDelayID id2 = SDD $ DASDelayID)
This size decreases by half because IDs are given as 1, delay starttime and delay time> Delay start-up Has been ordered by
[ID1 to
This external condition implements access to the matrix, note cbind:
[, ': =' (connected = extremes [cbind] (Sdd [sdd [DASDelayID == ID2, device ID], SDD [DASDelayID == ID1, device ID]) == 1,
It calculates the distance between delays, That's where people are not strictly positive
distance = as.integer (SDD [DASDelayID == ID2, DelayStartTimeSeconds] -sdd [DASDelayID == Can be used to filter ID1, DelayEndTimeSeconds]))]
I hope that this C and help.
No comments:
Post a Comment