Dear group kindly I have a logical data type ISINFCluster: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 15 16 17 18 19 20 21 22 23 24 25 26 27 28 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE 29 30 31 32 33 34 35 36 37 38 39 40 41 42 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 43 44 45 46 47 48 49 50 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE and I want to get just number of records from those that has the value true, thus firstclass<- all[ISINCluster] where all is numeric object 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 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 the firstclass containes the following firstclass 20 27 13 14 And I could not get the first row.. head(firstclass) 20 27 13 14 how can I got it? thanks in advance Ragia [[alternative HTML version deleted]]
Hi Ragia, This is a bit cryptic. "ISINFCluster" looks like a 50 element logical vector with two TRUE values. "all" looks like a 50 element numeric vector of counts for each value. "firstclass" contains the 20th and 27th elements of "all", selected with "ISINFCluster". As "firstclass" is a two element named vector, there is only one "row" and that includes the entire object. Jim On Sun, May 10, 2015 at 7:26 PM, Ragia Ibrahim <ragia11 at hotmail.com> wrote:> Dear group > kindly > > I have a logical data type > ISINFCluster: > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE > 29 30 31 32 33 34 35 36 37 38 39 40 41 42 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 43 44 45 46 47 48 49 50 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > > and I want to get just number of records from those that has the value true, thus > > firstclass<- all[ISINCluster] > where all is numeric object > 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 > 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 > > the firstclass containes the following > firstclass > 20 27 > 13 14 > > And I could not get the first row.. > head(firstclass) > 20 27 > 13 14 > > > how can I got it? > thanks in advance > Ragia > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Dear group I have this numeric object allrecords 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 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 how can I extract only records between 9 and 5 values only and put the record number n a vector it should be vector thanks in advance Ragia [[alternative HTML version deleted]]
It looks to me like you need to understand subscripting in R. One place (among many) to learn subscripting is: http://www.burns-stat.com/documents/tutorials/impatient-r/ Pat On 10/05/2015 10:26, Ragia Ibrahim wrote:> Dear group > kindly > > I have a logical data type > ISINFCluster: > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE > 29 30 31 32 33 34 35 36 37 38 39 40 41 42 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 43 44 45 46 47 48 49 50 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > > and I want to get just number of records from those that has the value true, thus > > firstclass<- all[ISINCluster] > where all is numeric object > 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 > 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 > > the firstclass containes the following > firstclass > 20 27 > 13 14 > > And I could not get the first row.. > head(firstclass) > 20 27 > 13 14 > > > how can I got it? > thanks in advance > Ragia > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Hello, You should learn about indexing in R. Read the pdf R-intro.pdf that comes with your installation of R. allrecords[5 <= allrecords & allrecords <= 9] should do it. Hope this helps, Rui Barradas Em 10-05-2015 11:00, Ragia Ibrahim escreveu:> Dear group > I have this numeric object > allrecords > 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 > 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 > > > how can I extract only records between 9 and 5 values only and put the record number n a vector > > it should be vector > thanks in advance > Ragia > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On May 10, 2015, at 2:26 AM, Ragia Ibrahim wrote:> Dear group > kindly > > I have a logical data type > ISINFCluster: > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE > 29 30 31 32 33 34 35 36 37 38 39 40 41 42 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > 43 44 45 46 47 48 49 50 > FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > > and I want to get just number of records from those that has the value true, thus > > firstclass<- all[ISINCluster] > where all is numeric object > 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 > 1 1 2 1 3 1 1 2 5 4 1 6 8 1 2 1 3 3 2 13 1 4 2 4 7 1 14 1 1 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > 1 1 2 2 1 1 2 2 2 9 3 1 1 3 6 1 4 1 3 9 2 > > the firstclass containes the following > firstclass > 20 27 > 13 14 > > And I could not get the first row.. > head(firstclass) > 20 27 > 13 14The thing you are calling "the first row" is actual the names attrobute for that vector.> > > how can I got it?names(firstclass)> thanks in advance > Ragia-- David Winsemius Alameda, CA, USA