? ?Dear group I have the following variable ? v_neighbours and it holds a vector of the following : ?gawker.com ? ? ?gle.am ? jezebel.com? ? ? ? ? ? 1 ? ? ? ? ?16 ? ? ? ? ?28? three urls and their id ...when I call the class(v_neighbours?) ?the result is ?"integer" how can I get the factor numeric values ?( 1,16,28) out of this variable. thanks in advance R.Ibrahim
Hello, Apparently your v_neighbours is a named vector of integers, so v_neighbours[1:3] or just v_neighbours will do the job(!) Hope this helps, Rui Barradas Quoting "Ragia ." <ragia11 at hotmail.com>:> ? > ?Dear group > I have the following variable ? v_neighbours and it holds a vector > of the following : > ?gawker.com ? ? ?gle.am ? jezebel.com? > ? ? ? ? ? 1 ? ? ? ? ?16 ? ? ? ? ?28? > > three urls and their id ...when I call the class(v_neighbours?) ?the > result is ?"integer" > how can I get the factor numeric values ?( 1,16,28) out of this variable. > > thanks in advance > R.Ibrahim > ______________________________________________ > 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.
?accept my apology for resending.. ? Dear group ?I have the following variable v_neighbours and it holds a vector of the following : ? gawker.com gle.am jezebel.com ? 1 16 28 to have a copy,? ?dput(v_neighbours) structure(c(1L, 16L, 28L), .Names = c("gawker.com", "gle.am",?"jezebel.com")) ?3 urls and their id ...when I call the class(v_neighbours ) the result is "integer" ? how can I get the factor numeric values ( 1,16,28) out of this variable. ? thanks in advance ? R.Ibrahim
Here, by example, might be what you're looking for:> v <- c(a=1, b=3, c=25) > va b c 1 3 25> unname(v)[1] 1 3 25 However, this has nothing to do with factors, and don't know what you mean by the "factor numeric values" of an object that isn't a factor. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/21/16, 10:27 AM, "R-help on behalf of Ragia ." <r-help-bounces at r-project.org on behalf of ragia11 at hotmail.com> wrote:> > > Dear group >I have the following variable v_neighbours and it holds a vector of the >following : > gawker.com gle.am jezebel.com > 1 16 28 > >three urls and their id ...when I call the class(v_neighbours ) the >result is "integer" >how can I get the factor numeric values ( 1,16,28) out of this variable. > >thanks in advance >R.Ibrahim >______________________________________________ >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.
many thanks...it solved my problem...and I will review what is factors..( I think I have misunderstanding in this) RagiA ? ----------------------------------------> From: macqueen1 at llnl.gov > To: ragia11 at hotmail.com; r-help at r-project.org > Subject: Re: [R] get values out of combined object > Date: Mon, 21 Mar 2016 20:53:28 +0000 > > Here, by example, might be what you're looking for: > >> v <- c(a=1, b=3, c=25) >> v > a b c > 1 3 25 >> unname(v) > [1] 1 3 25 > > > However, this has nothing to do with factors, and don't know what you mean > by the "factor numeric values" of an object that isn't a factor. > > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > > > > On 3/21/16, 10:27 AM, "R-help on behalf of Ragia ." > <r-help-bounces at r-project.org on behalf of ragia11 at hotmail.com> wrote: > >> >> >> Dear group >>I have the following variable v_neighbours and it holds a vector of the >>following : >> gawker.com gle.am jezebel.com >> 1 16 28 >> >>three urls and their id ...when I call the class(v_neighbours ) the >>result is "integer" >>how can I get the factor numeric values ( 1,16,28) out of this variable. >> >>thanks in advance >>R.Ibrahim >>______________________________________________ >>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. >