2

I have a question how to create a new column based on another.
Here is my part of data:

Category  Brand    Time1          value   Time2        number   
2         HTC      2015-01-01     1724    NA           1      
6         APPLE    2015-10-10     3000    2015-10-30   1
2         APPLE    2016-01-15     430     NA           1
NA        Samsung  2016-10-20     860     2016-12-20   1

I show 4 obs. of data above, and I explain my data more:
First, see the structure.

> str(data)
Classes ‘data.table’ and 'data.frame':  105907 obs. of  6 variables:
$ Category     : num  2 2 2 2 2 2 2 2 2 2 ...
$ Brand        : chr  "HTC" "APPLE" "INFOCUS" "APPLE" ...
$ Time1        : POSIXct, format: "2015-01-01" "2015-01-01" "2015-01-01" "2015-01-01" ...
$ value        : num  1724 2946 330 2946 2946 ...
$ Time2        : POSIXct, format: NA NA NA "2015-01-03" ...
$ number         : chr  "1" "1" "1" "1" ...
- attr(*, ".internal.selfref")=<externalptr>  

Second, I want to replicate each obs. based on Time1.
This is my code:

data[,rep:=ifelse(year(Time1)==2016, 12-month(Time1)+1, 13)][rep(1:.N,rep)][]   

Now, the data looks like:

Category  Brand    Time1          value   Time2        number   rep
2         HTC      2015-01-01     1724    NA           1        13       
2         HTC      2015-01-01     1724    NA           1        13       
2         HTC      2015-01-01     1724    NA           1        13   
2         HTC      2015-01-01     1724    NA           1        13     
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
2         HTC      2015-01-01     1724    NA           1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
6         APPLE    2015-10-10     3000    2015-10-30   1        13
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
2         APPLE    2016-01-15     430     NA           1        12
NA        Samsung  2016-10-20     860     2016-12-20   1        3
NA        Samsung  2016-10-20     860     2016-12-20   1        3
NA        Samsung  2016-10-20     860     2016-12-20   1        3

Third, I want to create a new column Lapse, and the result I want is:

Category  Brand    Time1          value   Time2        number   rep   Lapse
2         HTC      2015-01-01     1724    NA           1        13    0   
2         HTC      2015-01-01     1724    NA           1        13    1   
2         HTC      2015-01-01     1724    NA           1        13    2
2         HTC      2015-01-01     1724    NA           1        13    3 
2         HTC      2015-01-01     1724    NA           1        13    4
2         HTC      2015-01-01     1724    NA           1        13    5
2         HTC      2015-01-01     1724    NA           1        13    6
2         HTC      2015-01-01     1724    NA           1        13    7 
2         HTC      2015-01-01     1724    NA           1        13    8
2         HTC      2015-01-01     1724    NA           1        13    9 
2         HTC      2015-01-01     1724    NA           1        13    10 
2         HTC      2015-01-01     1724    NA           1        13    11
2         HTC      2015-01-01     1724    NA           1        13    12
6         APPLE    2015-10-10     3000    2015-10-30   1        13    0
6         APPLE    2015-10-10     3000    2015-10-30   1        13    1
6         APPLE    2015-10-10     3000    2015-10-30   1        13    2
6         APPLE    2015-10-10     3000    2015-10-30   1        13    3
6         APPLE    2015-10-10     3000    2015-10-30   1        13    4
6         APPLE    2015-10-10     3000    2015-10-30   1        13    5
6         APPLE    2015-10-10     3000    2015-10-30   1        13    6
6         APPLE    2015-10-10     3000    2015-10-30   1        13    7
6         APPLE    2015-10-10     3000    2015-10-30   1        13    8
6         APPLE    2015-10-10     3000    2015-10-30   1        13    9 
6         APPLE    2015-10-10     3000    2015-10-30   1        13    10
6         APPLE    2015-10-10     3000    2015-10-30   1        13    11
6         APPLE    2015-10-10     3000    2015-10-30   1        13    12 
2         APPLE    2016-01-15     430     NA           1        12    0
2         APPLE    2016-01-15     430     NA           1        12    1
2         APPLE    2016-01-15     430     NA           1        12    2
2         APPLE    2016-01-15     430     NA           1        12    3
2         APPLE    2016-01-15     430     NA           1        12    4
2         APPLE    2016-01-15     430     NA           1        12    5 
2         APPLE    2016-01-15     430     NA           1        12    6 
2         APPLE    2016-01-15     430     NA           1        12    7
2         APPLE    2016-01-15     430     NA           1        12    8
2         APPLE    2016-01-15     430     NA           1        12    9
2         APPLE    2016-01-15     430     NA           1        12    10 
2         APPLE    2016-01-15     430     NA           1        12    11
NA        Samsung  2016-10-20     860     2016-12-20   1        3     0
NA        Samsung  2016-10-20     860     2016-12-20   1        3     1
NA        Samsung  2016-10-20     860     2016-12-20   1        3     2

Above is the result I want, I try the code like this:

data[,Lapse := seq_len(.N)-1, by = (Category,Brand,Time1,value,Time2,number)]   

However, it is wrong.

If it is right,

uniqie(data$Lapse) 
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 

But, I got 0~999. I think my code is wrong.
Any suggestion?
Or maybe there are other good ways to do like this?

enter image description here

UPDATE

data <- "    Category        Brand Time1 value Time2 number
1:        2          HTC    2015-01-01    1724       NA    1
2:        2        APPLE    2015-01-01    2946       NA    1
3:        2      INFOCUS    2015-01-01     330       NA    1
4:        2        APPLE    2015-01-01    2946 2015-01-03    1
5:        2        APPLE    2015-01-01    2946       NA    1
6:        2      Samsung    2015-01-01    2189       NA    1
7:        2          HTC    2015-01-01     730       NA    1
8:        2      Samsung    2015-01-01    2189       NA    1
9:        2      Samsung    2015-01-01    2189       NA    1
10:        2          HTC    2015-01-01    1296       NA    1
11:        2          HTC    2015-01-01     730       NA    1
12:        2        APPLE    2015-01-01    2189       NA    1
13:        2      INFOCUS    2015-01-01     330 2015-01-02    1
14:        2          HTC    2015-01-01    2189       NA    1
15:        2         SONY    2015-01-01    1296       NA    1
16:        2          HTC    2015-01-01     730       NA    1
17:        2        APPLE    2015-01-01    2946       NA    1
18:        2        APPLE    2015-01-01    2946       NA    1
19:        2          HTC    2015-01-01    1724       NA    1
20:        2      Samsung    2015-01-02    1724       NA    1
21:        2      Samsung    2015-01-02    2189       NA    1
22:        2          HTC    2015-01-02     730       NA    1
23:        2      Samsung    2015-01-02    2189       NA    1
24:        2          HTC    2015-01-02     730       NA    1
25:        2        APPLE    2015-01-02    2946       NA    1
26:        2          HTC    2015-01-02    1724       NA    1
27:        2          HTC    2015-01-02     730       NA    1
28:        2         ASUS    2015-01-02     330       NA    1
29:        2         ASUS    2015-01-02     330       NA    1
30:        2      Samsung    2015-01-02    1724       NA    1
31:        2        APPLE    2015-01-02    2189       NA    1
32:        2          HTC    2015-01-02     730       NA    1
33:        2      Samsung    2015-01-02     730       NA    1
34:        2          HTC    2015-01-02     730       NA    1
35:        2          HTC    2015-01-02     730       NA    1
36:        2          HTC    2015-01-02     730       NA    1
37:        2      Samsung    2015-01-02     730       NA    1
38:        2        APPLE    2015-01-03    2189       NA    1
39:        2        APPLE    2015-01-03    2946       NA    1
40:        2       Benten    2015-01-03     330       NA    1
41:        2        APPLE    2015-01-03    2946       NA    1
42:        2      INFOCUS    2015-01-03     330       NA    1
43:        2      Samsung    2015-01-03    1296       NA    1
44:        2          HTC    2015-01-03     730       NA    1
45:        2      Samsung    2015-01-03    2189       NA    1
46:        2         SONY    2015-01-03    2189       NA    1
47:        2 TaiwanMobile    2015-01-03     730       NA    1
48:        2          HTC    2015-01-03    1296       NA    1
49:        2          HTC    2015-01-03     730       NA    1
50:        2        APPLE    2015-01-03    2189       NA    1
51:        2        APPLE    2015-01-03    2189       NA    1
52:        2          HTC    2015-01-03     730       NA    1
53:        2      Samsung    2015-01-03     330       NA    1
54:        2 TaiwanMobile    2015-01-03     730       NA    1
55:        2          HTC    2015-01-03     730       NA    1
56:        2          HTC    2015-01-03     730       NA    1
57:        2 TaiwanMobile    2015-01-03     330       NA    1
58:        2      Samsung    2015-01-03    1724 2015-01-04    1
59:        2          HTC    2015-01-03     730       NA    1
60:        2      INFOCUS    2015-01-03     330       NA    1
61:        2         SONY    2015-01-03     730       NA    1
62:        2          HTC    2015-01-04     730       NA    1
63:        2          HTC    2015-01-04     730       NA    1
64:        2        APPLE    2015-01-04    2189 2015-01-05    1
65:        2 TaiwanMobile    2015-01-04     730 2015-01-05    1"  

data <- read.table(text=data, header = TRUE)
data <- as.data.table(data)
data <- data[,rep:=ifelse(year(Time1)==2016, 12-month(Time1)+1, 13)][rep(1:.N,rep)][]
data[, Lapse := seq_len(.N)-1 , .(Category, Brand, Time1, value, Time2, number)]

dput(droplevels(head(data,65)))
structure(list(Category = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), Brand = c("HTC", "APPLE", 
"INFOCUS", "APPLE", "APPLE", "Samsung", "HTC", "Samsung", "Samsung", 
"HTC", "HTC", "APPLE", "INFOCUS", "HTC", "SONY", "HTC", "APPLE", 
"APPLE", "HTC", "Samsung", "Samsung", "HTC", "Samsung", "HTC", 
"APPLE", "HTC", "HTC", "ASUS", "ASUS", "Samsung", "APPLE", "HTC", 
"Samsung", "HTC", "HTC", "HTC", "Samsung", "APPLE", "APPLE", 
"Benten", "APPLE", "INFOCUS", "Samsung", "HTC", "Samsung", "SONY", 
"TaiwanMobile", "HTC", "HTC", "APPLE", "APPLE", "HTC", "Samsung", 
"TaiwanMobile", "HTC", "HTC", "TaiwanMobile", "Samsung", "HTC", 
"INFOCUS", "SONY", "HTC", "HTC", "APPLE", "TaiwanMobile"), Time1 = structure(c(1420070400, 
1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 
1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 
1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 1420070400, 
1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 
1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 
1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 1420156800, 
1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 
1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 
1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 
1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 1420243200, 
1420329600, 1420329600, 1420329600, 1420329600), class = c("POSIXct", 
"POSIXt"), tzone = "UTC"), value = c(1724, 2946, 330, 2946, 
2946, 2189, 730, 2189, 2189, 1296, 730, 2189, 330, 2189, 1296, 
730, 2946, 2946, 1724, 1724, 2189, 730, 2189, 730, 2946, 1724, 
730, 330, 330, 1724, 2189, 730, 730, 730, 730, 730, 730, 2189, 
2946, 330, 2946, 330, 1296, 730, 2189, 2189, 730, 1296, 730, 
2189, 2189, 730, 330, 730, 730, 730, 330, 1724, 730, 330, 730, 
730, 730, 2189, 730), Time2 = structure(c(NA, NA, NA, 1420243200, 
NA, NA, NA, NA, NA, NA, NA, NA, 1420156800, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, 1420329600, NA, NA, NA, NA, NA, 1420416000, 
1420416000), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
number = c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", 
"1", "1", "1", "1", "1", "1", "1")), .Names = c("Category", 
"Brand", "Time1", "value", "Time2", "number"), row.names = c(NA, 
-65L), .internal.selfref = <pointer: 0x003e24a0>, class = c("data.table", 
"data.frame"))

And the problem is the result is weird.

unique(data$Lapse)
[1]  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
[38] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
[75] 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
Peter Chen
  • 1,464
  • 3
  • 21
  • 48
  • 1
    Can you check if those NAs are real NAs or string or factors? Also suppose if your 'Time2' after the replication is say `c(NA, NA, '2015-10-30', '2015-10-30', NA, NA)` how would the groups looks like – akrun May 08 '17 at 03:52
  • How can I check whether those NAs are real or not? I use `is.na(data$Time2)` and I get `[1] True True ....`, so they are real right? – Peter Chen May 08 '17 at 03:57
  • Okay, then it is not character. Regarding the groups, do you think you would need `c(1, 1, 2, 2, 3, 3)` – akrun May 08 '17 at 04:02
  • I tried to replicate your condition, but I was not able to `data1 <- data.table(Category = 2, Brand = "Apple", Time1 = as.POSIXct("2015-01-01"), value = 2946, Time2 = as.POSIXct(rep(c("2015-01-03", NA), each = 10)), number=1); data1[, Lapse := seq_len(.N)-1, .(Category, Brand, Time1, value, Time2, number)];data1$Lapse# [1] 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9` – akrun May 08 '17 at 04:07
  • `c(1, 1, 2, 2, 3, 3)`? you mean maybe I can change `NA` to **a character NA** – Peter Chen May 08 '17 at 04:08
  • No, I was checking why you got a different result. As I showed with an example above, it is working fine for me – akrun May 08 '17 at 04:10
  • Maybe the problem is `Time2`? As the attached image, I think it considers `2015-01-03` and `NA` to be the same. Same as my other observations. So the groups when I use `seq_len()` will create like this – Peter Chen May 08 '17 at 04:13
  • But, it is not considering same in my example 'data1' Could you post the dput of the 'data' uptill 65 rows before we do the `Lapse` step? I have to go now.. Will check later – akrun May 08 '17 at 04:15
  • @akrun I update my question, check please. – Peter Chen May 08 '17 at 05:49
  • If i use the `dput` output and run the code to assign `Lapse` I get `data$Lapse# [1] 0 0 0 0 1 0 0 1 2 0 1 0 0 0 0 2 2 3 1 0 0 0 1 1 0 0 2 0 1 1 0 3 0 4 5 6 1 0 0 0 1 0 0 0 0 0 0 0 1 1 2 2 0 1 3 4 0 0 5 1 0 0 1 0 0` Here, the 'Brand' is not ordered and if I do the `order` i.e. `data[order(Category, Brand, Time1, value, Time2, number)]$Lapse #[1] 0 0 0 1 2 3 0 0 0 1 2 0 1 0 0 1 0 0 1 2 0 0 1 0 0 1 2 3 4 5 6 0 0 1 2 3 4 5 0 0 1 0 0 0 1 0 0 0 0 1 2 0 1 0 1 0 1 0 0 0 0 0 0 1 0` – akrun May 08 '17 at 06:04
  • why you know `Brand` is not ordered? So, you mean the problem is caused by `Brand`? – Peter Chen May 08 '17 at 06:09
  • If you check the dput 'data', I get `head(data$Brand, 10)# [1] "HTC" "APPLE" "INFOCUS" "APPLE" "APPLE" "Samsung" "HTC" "Samsung" "Samsung" "HTC"` – akrun May 08 '17 at 06:10
  • Yes, but why **not ordered**? They are just `data`? – Peter Chen May 08 '17 at 06:15
  • 1
    What I meant is that the `:=` will assign it to based on the original position of the values in the dataset. It is also correct, but if you wanted to have something like `0 1 2 3 0 1 2` , the grouping variables should be ordered earlier – akrun May 08 '17 at 06:16
  • I don't understand why group earlier or later will affect the result. – Peter Chen May 08 '17 at 06:35
  • Imagine if you have a column with `v1 <- c("A", "B", "A", "B", "C")` then your output would be `ave(seq_along(v1), v1, FUN = seq_along)-1# [1] 0 0 1 1 0` and suppose if it is `v2 <- c("A", "A", "B", "B", "C"); ave(seq_along(v2), v2, FUN = seq_along)-1# [1] 0 1 0 1 0` – akrun May 08 '17 at 06:37
  • Also, your original example was already showed to be grouped, so it give the output as expected – akrun May 08 '17 at 06:39
  • Do I need to use `dplyr::group_by(data, Category, Brand, Time1)` before replicating? – Peter Chen May 08 '17 at 06:58
  • 2
    What we have done is correct. Only thing is that you can either do an ordering after or before the creation of 'Lapse' column – akrun May 08 '17 at 06:59
  • can u edit ur answer below? I'm not sure I really understand – Peter Chen May 08 '17 at 07:05
  • I try `data <- data[,rep:=ifelse(year(Time1)==2016, 12-month(Time1)+1, 13)][rep(1:.N,rep)][]; dplyr::group_by(data,Category,Brand,Time1,value,Time2,number); data[, Lapse := seq_len(.N)-1 , .(Category, Brand, Time1, value, Time2, number)]`. Still wrong – Peter Chen May 08 '17 at 07:13
  • 2
    The `dplyr::group_by` is not doing anything here. You may need `data <- data[order(Category, Brand, Time1, value, Time2, number)]; data[, Lapse := seq_len(.N)-1 , .(Category, Brand, Time1, value, Time2, number)]` – akrun May 08 '17 at 07:17
  • Still not work. you can try my update code and add this into it – Peter Chen May 08 '17 at 07:23
  • I am a bit lost at your update there. I thought the rows you generated with `data <- read.table(text=data, header = TRUE)` is already replicated? – akrun May 08 '17 at 07:25
  • lost? copy it directly into R console and run. So you can see the datatable – Peter Chen May 08 '17 at 07:31
  • Yes, that I am able to run. What I am referring to is the original data based on the first code block dataset – akrun May 08 '17 at 07:32
  • I try `data <- data[order(Category, Brand, Time1, value, Time2, number)]`. But, if I have many columns, how can I edit my code that I don't need to type each column names – Peter Chen May 08 '17 at 08:51
  • 2
    you can do `data[data[,do.call(order, .SD), .SDcols = 1:6]]` – akrun May 08 '17 at 09:13
  • 1
    I think you cannot get the correct value may because your example data above does not show all your columns. Thus, when you do `seq_len()`, there are many repeated value in one of your columns. @akrun's comment is awesome. –  May 10 '17 at 03:22
  • 1
    To figure out this, I think you must to order **all** your columns before create `Lapse`, and then try `data[, Lapse := seq_len(.N)-1 , .(Category, Brand, Time1, value, Time2, number)]`. But `.(Category, Brand, Time1, value, Time2, number)` has to change to your columns and you need to check your columns before doing this. –  May 10 '17 at 03:25
  • 2
    @akrun I run Chen's update code and I can get his example and get the same result with him. I think if you do, you will get the same. The problem may be caused by his other columns, not showing in this question. –  May 10 '17 at 03:28
  • @akrun I think you can add your comment to your answer in the following –  May 10 '17 at 06:17
  • @PeterTW Thanks, I am waiting for the OP to give some more info – akrun May 10 '17 at 06:19
  • @akrun what is OP? sorry, I didn't use this platform for a long time –  May 10 '17 at 07:30
  • @PeterTW I meant the original poster – akrun May 10 '17 at 07:31
  • 1
    @PeterTW thanks, it is actually caused by other columns that I didn't post in the question. – Peter Chen May 10 '17 at 07:45
  • 1
    @akrun I solved this. Your code is right. However, the problem is due to other columns. I shouldn't `subset` my data but should order them after reading into Rstudio immediately. – Peter Chen May 10 '17 at 07:47
  • However, I don't really understand why my data in the above update question cannot create correctly. Even I order them before create `Lapse` – Peter Chen May 10 '17 at 07:51

1 Answers1

1

The problem is that the original data is not updated as it has the same number of rows as before. If we check the output of

data[,rep:=ifelse(year(Time1)==2016, 12-month(Time1)+1, 13)][rep(1:.N,rep)]

and then the

data

it becomes obvious.

So, we assign the output from the two steps back to the original object ('data') or another object (if we don't want to change the original object)

data <-  data[,rep:=ifelse(year(Time1)==2016, 12-month(Time1)+1, 13)][rep(1:.N,rep)]

and create the 'Lapse' column based on the sequence by group

data[, Lapse := seq_len(.N)-1 , .(Category, Brand, Time1, value, Time2, number)]
data
    Category   Brand      Time1 value      Time2 number rep Lapse
 1:        2     HTC 2015-01-01  1724       <NA>      1  13     0
 2:        2     HTC 2015-01-01  1724       <NA>      1  13     1
 3:        2     HTC 2015-01-01  1724       <NA>      1  13     2
 4:        2     HTC 2015-01-01  1724       <NA>      1  13     3
 5:        2     HTC 2015-01-01  1724       <NA>      1  13     4
 6:        2     HTC 2015-01-01  1724       <NA>      1  13     5
 7:        2     HTC 2015-01-01  1724       <NA>      1  13     6
 8:        2     HTC 2015-01-01  1724       <NA>      1  13     7
 9:        2     HTC 2015-01-01  1724       <NA>      1  13     8
10:        2     HTC 2015-01-01  1724       <NA>      1  13     9
11:        2     HTC 2015-01-01  1724       <NA>      1  13    10
12:        2     HTC 2015-01-01  1724       <NA>      1  13    11
13:        2     HTC 2015-01-01  1724       <NA>      1  13    12
14:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     0
15:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     1
16:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     2
17:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     3
18:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     4
19:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     5
20:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     6
21:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     7
22:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     8
23:        6   APPLE 2015-10-10  3000 2015-10-30      1  13     9
24:        6   APPLE 2015-10-10  3000 2015-10-30      1  13    10
25:        6   APPLE 2015-10-10  3000 2015-10-30      1  13    11
26:        6   APPLE 2015-10-10  3000 2015-10-30      1  13    12
27:        2   APPLE 2016-01-15   430       <NA>      1  12     0
28:        2   APPLE 2016-01-15   430       <NA>      1  12     1
29:        2   APPLE 2016-01-15   430       <NA>      1  12     2
30:        2   APPLE 2016-01-15   430       <NA>      1  12     3
31:        2   APPLE 2016-01-15   430       <NA>      1  12     4
32:        2   APPLE 2016-01-15   430       <NA>      1  12     5
33:        2   APPLE 2016-01-15   430       <NA>      1  12     6
34:        2   APPLE 2016-01-15   430       <NA>      1  12     7
35:        2   APPLE 2016-01-15   430       <NA>      1  12     8
36:        2   APPLE 2016-01-15   430       <NA>      1  12     9
37:        2   APPLE 2016-01-15   430       <NA>      1  12    10
38:        2   APPLE 2016-01-15   430       <NA>      1  12    11
39:       NA Samsung 2016-10-20   860 2016-12-20      1   3     0
40:       NA Samsung 2016-10-20   860 2016-12-20      1   3     1
41:       NA Samsung 2016-10-20   860 2016-12-20      1   3     2
akrun
  • 874,273
  • 37
  • 540
  • 662