Grokbase Groups R r-help October 2005
FAQ
Dear R-list,
I have a dataset, say (the real dataset is 20 columns,110200 rows).
my.reducedID
V1 V2 V3 V4 V5 V6 V7 V8 V9
[1,] 1 0 0 1 14 3 1 0 2
[2,] 2 0 0 1 14 3 1 0 2
[3,] 0 1 0 1 14 2 1 0 2
[4,] 0 0 1 1 14 3 1 0 2
[5,] 0 1 1 0 14 2 1 0 2
[6,] 0 0 0 1 14 3 1 0 2
[7,] 0 0 0 1 0 3 1 0 2
[8,] 0 0 0 1 1 3 1 0 2
[9,] 0 0 0 1 2 3 1 0 2
[10,] 0 0 0 1 3 3 1 0 2
[11,] 0 0 0 1 4 3 1 0 2
[12,] 0 0 0 1 5 3 1 0 2
[13,] 0 0 0 1 6 3 1 0 2
[14,] 0 0 0 1 7 3 1 0 2
[15,] 0 0 0 1 8 3 1 0 2
[16,] 0 0 0 1 9 3 1 0 2
[17,] 0 0 0 1 10 3 1 0 2
[18,] 0 0 0 1 11 3 1 0 2
[19,] 0 0 0 1 12 3 1 0 2
[20,] 0 0 0 1 13 3 1 0 2
[21,] 0 0 0 1 15 3 1 0 2
[22,] 0 0 0 1 16 3 1 0 2
[23,] 0 0 0 1 17 3 1 0 2
[24,] 0 0 0 1 18 3 1 0 2
[25,] 0 0 0 1 19 3 1 0 2
[26,] 0 0 0 1 20 3 1 0 2
[27,] 0 0 0 1 14 0 1 0 2
[28,] 0 0 0 1 14 1 1 0 2
[29,] 0 0 0 1 14 2 1 0 2
[30,] 0 0 0 1 14 4 1 0 2
>

I want to search a value in variables, say V1=0, V5 and V6=2.
The result should look like
V1 V2 V3 V4 V5 V6 V7 V8 V9
[3,] 0 1 0 1 14 2 1 0 2
[5,] 0 1 1 0 14 2 1 0 2
[29,] 0 0 0 1 14 2 1 0 2

I can do this with: my.reducedID[c(3,5,29),]
Because I have very large dataset I can not make this manual.
Then I need the ID of row did not change, I mean like,
[3,]
[5,]
[29,]
In dataset this is about ID our customers.
I was wondering if anyone give me a trick to make simple.
Thanks you very much for any suggestions.

Best, Muhammad Subianto

Search Discussions

  • Ronggui at Oct 20, 2005 at 2:29 pm
    use logical index.
    my.reducedID<-read.table(file.choose())
    head(my.reducedID)
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    attach(my.reducedID)
    my.reducedID[(V1==0 & V5= & V6==2),]
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2


    ======= 2005-10-20 21:59:24 �ā��ԁځ����ЁŁցЁЁ���������======
    Dear R-list,
    I have a dataset, say (the real dataset is 20 columns,110200 rows).
    my.reducedID
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    [7,] 0 0 0 1 0 3 1 0 2
    [8,] 0 0 0 1 1 3 1 0 2
    [9,] 0 0 0 1 2 3 1 0 2
    [10,] 0 0 0 1 3 3 1 0 2
    [11,] 0 0 0 1 4 3 1 0 2
    [12,] 0 0 0 1 5 3 1 0 2
    [13,] 0 0 0 1 6 3 1 0 2
    [14,] 0 0 0 1 7 3 1 0 2
    [15,] 0 0 0 1 8 3 1 0 2
    [16,] 0 0 0 1 9 3 1 0 2
    [17,] 0 0 0 1 10 3 1 0 2
    [18,] 0 0 0 1 11 3 1 0 2
    [19,] 0 0 0 1 12 3 1 0 2
    [20,] 0 0 0 1 13 3 1 0 2
    [21,] 0 0 0 1 15 3 1 0 2
    [22,] 0 0 0 1 16 3 1 0 2
    [23,] 0 0 0 1 17 3 1 0 2
    [24,] 0 0 0 1 18 3 1 0 2
    [25,] 0 0 0 1 19 3 1 0 2
    [26,] 0 0 0 1 20 3 1 0 2
    [27,] 0 0 0 1 14 0 1 0 2
    [28,] 0 0 0 1 14 1 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    [30,] 0 0 0 1 14 4 1 0 2
    I want to search a value in variables, say V1=0, V5 and V6=2.
    The result should look like
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2

    I can do this with: my.reducedID[c(3,5,29),]
    Because I have very large dataset I can not make this manual.
    Then I need the ID of row did not change, I mean like,
    [3,]
    [5,]
    [29,]
    In dataset this is about ID our customers.
    I was wondering if anyone give me a trick to make simple.
    Thanks you very much for any suggestions.

    Best, Muhammad Subianto

    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
    = = = = = = = = = = = = = = = = = = =




    2005-10-20

    ------
    Deparment of Sociology
    Fudan University

    My new mail addres is ronggui.huang at gmail.com
    Blog:http://sociology.yculblog.com
  • Uwe Ligges at Oct 20, 2005 at 2:50 pm

    Muhammad Subianto wrote:

    Dear R-list,
    I have a dataset, say (the real dataset is 20 columns,110200 rows).
    my.reducedID
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    [7,] 0 0 0 1 0 3 1 0 2
    [8,] 0 0 0 1 1 3 1 0 2
    [9,] 0 0 0 1 2 3 1 0 2
    [10,] 0 0 0 1 3 3 1 0 2
    [11,] 0 0 0 1 4 3 1 0 2
    [12,] 0 0 0 1 5 3 1 0 2
    [13,] 0 0 0 1 6 3 1 0 2
    [14,] 0 0 0 1 7 3 1 0 2
    [15,] 0 0 0 1 8 3 1 0 2
    [16,] 0 0 0 1 9 3 1 0 2
    [17,] 0 0 0 1 10 3 1 0 2
    [18,] 0 0 0 1 11 3 1 0 2
    [19,] 0 0 0 1 12 3 1 0 2
    [20,] 0 0 0 1 13 3 1 0 2
    [21,] 0 0 0 1 15 3 1 0 2
    [22,] 0 0 0 1 16 3 1 0 2
    [23,] 0 0 0 1 17 3 1 0 2
    [24,] 0 0 0 1 18 3 1 0 2
    [25,] 0 0 0 1 19 3 1 0 2
    [26,] 0 0 0 1 20 3 1 0 2
    [27,] 0 0 0 1 14 0 1 0 2
    [28,] 0 0 0 1 14 1 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    [30,] 0 0 0 1 14 4 1 0 2
    I want to search a value in variables, say V1=0, V5 and V6=2.
    The result should look like
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2

    I can do this with: my.reducedID[c(3,5,29),]
    Because I have very large dataset I can not make this manual.
    Then I need the ID of row did not change, I mean like,
    [3,]
    [5,]
    [29,]
    In dataset this is about ID our customers.
    I was wondering if anyone give me a trick to make simple.
    Thanks you very much for any suggestions.
    Without having tested:
    with(my.reducedID, rownames(V1==0 & V5= & V6==2))

    Uwe Ligges
    Best, Muhammad Subianto

    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
  • Ronggui at Oct 20, 2005 at 3:04 pm
    use logical index.
    my.reducedID<-read.table(file.choose())
    head(my.reducedID)
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    attach(my.reducedID)
    my.reducedID[(V1==0 & V5= & V6==2),]
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2


    ======= 2005-10-20 21:59:24 �ā��ԁځ����ЁŁցЁЁ���������======
    Dear R-list,
    I have a dataset, say (the real dataset is 20 columns,110200 rows).
    my.reducedID
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    [7,] 0 0 0 1 0 3 1 0 2
    [8,] 0 0 0 1 1 3 1 0 2
    [9,] 0 0 0 1 2 3 1 0 2
    [10,] 0 0 0 1 3 3 1 0 2
    [11,] 0 0 0 1 4 3 1 0 2
    [12,] 0 0 0 1 5 3 1 0 2
    [13,] 0 0 0 1 6 3 1 0 2
    [14,] 0 0 0 1 7 3 1 0 2
    [15,] 0 0 0 1 8 3 1 0 2
    [16,] 0 0 0 1 9 3 1 0 2
    [17,] 0 0 0 1 10 3 1 0 2
    [18,] 0 0 0 1 11 3 1 0 2
    [19,] 0 0 0 1 12 3 1 0 2
    [20,] 0 0 0 1 13 3 1 0 2
    [21,] 0 0 0 1 15 3 1 0 2
    [22,] 0 0 0 1 16 3 1 0 2
    [23,] 0 0 0 1 17 3 1 0 2
    [24,] 0 0 0 1 18 3 1 0 2
    [25,] 0 0 0 1 19 3 1 0 2
    [26,] 0 0 0 1 20 3 1 0 2
    [27,] 0 0 0 1 14 0 1 0 2
    [28,] 0 0 0 1 14 1 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    [30,] 0 0 0 1 14 4 1 0 2
    I want to search a value in variables, say V1=0, V5 and V6=2.
    The result should look like
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2

    I can do this with: my.reducedID[c(3,5,29),]
    Because I have very large dataset I can not make this manual.
    Then I need the ID of row did not change, I mean like,
    [3,]
    [5,]
    [29,]
    In dataset this is about ID our customers.
    I was wondering if anyone give me a trick to make simple.
    Thanks you very much for any suggestions.

    Best, Muhammad Subianto

    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
    = = = = = = = = = = = = = = = = = = =




    2005-10-20

    ------
    Deparment of Sociology
    Fudan University

    My new mail addres is ronggui.huang at gmail.com
    Blog:http://sociology.yculblog.com
  • Muhammad Subianto at Oct 20, 2005 at 3:32 pm
    Dear All,
    Perfect. Thanks you very much for your help.

    Best, Muhammad Subianto

    my.reducedID<-read.table(file.choose())
    head(my.reducedID)
    >
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    >
    attach(my.reducedID)
    my.reducedID[(V1==0 & V5= & V6==2),]
    >
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    >

    ######## OR ##########
    my.reducedID[ my.reducedID[,1]==0 & my.reducedID[,5]= &
    my.reducedID[,6]==2, ]
    >

    On this day 20/10/2005 03:59 PM, Muhammad Subianto wrote:
    Dear R-list,
    I have a dataset, say (the real dataset is 20 columns,110200 rows).
    my.reducedID
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    [7,] 0 0 0 1 0 3 1 0 2
    [8,] 0 0 0 1 1 3 1 0 2
    [9,] 0 0 0 1 2 3 1 0 2
    [10,] 0 0 0 1 3 3 1 0 2
    [11,] 0 0 0 1 4 3 1 0 2
    [12,] 0 0 0 1 5 3 1 0 2
    [13,] 0 0 0 1 6 3 1 0 2
    [14,] 0 0 0 1 7 3 1 0 2
    [15,] 0 0 0 1 8 3 1 0 2
    [16,] 0 0 0 1 9 3 1 0 2
    [17,] 0 0 0 1 10 3 1 0 2
    [18,] 0 0 0 1 11 3 1 0 2
    [19,] 0 0 0 1 12 3 1 0 2
    [20,] 0 0 0 1 13 3 1 0 2
    [21,] 0 0 0 1 15 3 1 0 2
    [22,] 0 0 0 1 16 3 1 0 2
    [23,] 0 0 0 1 17 3 1 0 2
    [24,] 0 0 0 1 18 3 1 0 2
    [25,] 0 0 0 1 19 3 1 0 2
    [26,] 0 0 0 1 20 3 1 0 2
    [27,] 0 0 0 1 14 0 1 0 2
    [28,] 0 0 0 1 14 1 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    [30,] 0 0 0 1 14 4 1 0 2
    I want to search a value in variables, say V1=0, V5 and V6=2.
    The result should look like
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2

    I can do this with: my.reducedID[c(3,5,29),]
    Because I have very large dataset I can not make this manual.
    Then I need the ID of row did not change, I mean like,
    [3,]
    [5,]
    [29,]
    In dataset this is about ID our customers.
    I was wondering if anyone give me a trick to make simple.
    Thanks you very much for any suggestions.

    Best, Muhammad Subianto

    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
  • Ronggui at Oct 20, 2005 at 3:55 pm
    ======= 2005-10-20 22:50:07 �ā��ԁځ����ЁŁցЁЁ���������======
    Muhammad Subianto wrote:
    Dear R-list,
    I have a dataset, say (the real dataset is 20 columns,110200 rows).
    my.reducedID
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [1,] 1 0 0 1 14 3 1 0 2
    [2,] 2 0 0 1 14 3 1 0 2
    [3,] 0 1 0 1 14 2 1 0 2
    [4,] 0 0 1 1 14 3 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [6,] 0 0 0 1 14 3 1 0 2
    [7,] 0 0 0 1 0 3 1 0 2
    [8,] 0 0 0 1 1 3 1 0 2
    [9,] 0 0 0 1 2 3 1 0 2
    [10,] 0 0 0 1 3 3 1 0 2
    [11,] 0 0 0 1 4 3 1 0 2
    [12,] 0 0 0 1 5 3 1 0 2
    [13,] 0 0 0 1 6 3 1 0 2
    [14,] 0 0 0 1 7 3 1 0 2
    [15,] 0 0 0 1 8 3 1 0 2
    [16,] 0 0 0 1 9 3 1 0 2
    [17,] 0 0 0 1 10 3 1 0 2
    [18,] 0 0 0 1 11 3 1 0 2
    [19,] 0 0 0 1 12 3 1 0 2
    [20,] 0 0 0 1 13 3 1 0 2
    [21,] 0 0 0 1 15 3 1 0 2
    [22,] 0 0 0 1 16 3 1 0 2
    [23,] 0 0 0 1 17 3 1 0 2
    [24,] 0 0 0 1 18 3 1 0 2
    [25,] 0 0 0 1 19 3 1 0 2
    [26,] 0 0 0 1 20 3 1 0 2
    [27,] 0 0 0 1 14 0 1 0 2
    [28,] 0 0 0 1 14 1 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    [30,] 0 0 0 1 14 4 1 0 2
    I want to search a value in variables, say V1=0, V5 and V6=2.
    The result should look like
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2

    I can do this with: my.reducedID[c(3,5,29),]
    Because I have very large dataset I can not make this manual.
    Then I need the ID of row did not change, I mean like,
    [3,]
    [5,]
    [29,]
    In dataset this is about ID our customers.
    I was wondering if anyone give me a trick to make simple.
    Thanks you very much for any suggestions.
    Without having tested:
    with(my.reducedID, rownames(V1==0 & V5= & V6==2))
    It doesn't work.
    with(my.reducedID, rownames(V1==0 & V5= & V6==2))
    NULL

    But the following does
    my.reducedID[with(my.reducedID, (V1==0 & V5= & V6==2)),]
    V1 V2 V3 V4 V5 V6 V7 V8 V9
    [3,] 0 1 0 1 14 2 1 0 2
    [5,] 0 1 1 0 14 2 1 0 2
    [29,] 0 0 0 1 14 2 1 0 2
    Uwe Ligges
    Best, Muhammad Subianto

    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
    ______________________________________________
    R-help at stat.math.ethz.ch mailing list
    https://stat.ethz.ch/mailman/listinfo/r-help
    PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
    = = = = = = = = = = = = = = = = = = =




    2005-10-20

    ------
    Deparment of Sociology
    Fudan University

    My new mail addres is ronggui.huang at gmail.com
    Blog:http://sociology.yculblog.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedOct 20, '05 at 1:59p
activeOct 20, '05 at 3:55p
posts6
users3
websiter-project.org
irc#r

People

Translate

site design / logo © 2022 Grokbase