upposed to be numeric you can check if they really are by
str(df)
Cheers
Petr
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of ch.elahe
> via R-help
> Sent: Tuesday, June 14, 2016 5:29 PM
> To: R-help Mailing List
> Subject: [R
Hi all,
I want to use Supervised Self organizing Maps from Kohonen package for my data.
I need to divide my df into training set and test set, but a part of my df
contains column with factor levels and I don't know how to bring them into my
training set. Currently I use the following command fo
Hi all,
I want to use Supervised Self organizing Maps from Kohonen package for my data.
I need to divide my df into training set and test set, but a part of my df
contains column with factor levels and I don't know how to bring them into my
training set. Currently I use the following command
Hi,
Suppose your data frame is called data and the name of the factor column
is named tobeConverted. I have tried this and it worked. Hope this helps.
> as.numeric(as.character(data$tobeConverted))
--
View this message in context:
http://r.789695.n4.nabble.com/factor-levels-numeric-values
ent of Anthropology
>Texas A&M University
>College Station, TX 77840-4352
>
>-Original Message-
>From: r-help-boun...@r-project.org
>[mailto:r-help-boun...@r-project.org] On Behalf Of Gerrit Eichner
>Sent: Wednesday, November 12, 2014 8:06 AM
>To: David Studer
>Cc: r-he
rrit Eichner
Sent: Wednesday, November 12, 2014 8:06 AM
To: David Studer
Cc: r-help@r-project.org
Subject: Re: [R] factor levels > numeric values
Hello, David,
take a look at the beginning of the "Warning" section of ?factor.
Hth -- Gerrit
Hi everybody,
I have another que
c: r-help@r-project.org
Subject: Re: [R] factor levels > numeric values
Hello, David,
take a look at the beginning of the "Warning" section of ?factor.
Hth -- Gerrit
> Hi everybody,
>
> I have another question (to which I could not find an answer in my r-books.
> I am
Hello, David,
take a look at the beginning of the "Warning" section of ?factor.
Hth -- Gerrit
Hi everybody,
I have another question (to which I could not find an answer in my r-books.
I am sure, it's not a great issue, but I simply lack of a good idea how to
solve this:
One of my variable
Hi everybody,
I have another question (to which I could not find an answer in my r-books.
I am sure, it's not a great issue, but I simply lack of a good idea how to
solve this:
One of my variables gets imported as a factor instead of a numeric variable.
Now I have a...
Factor w/ 63 levels "0","0
Peter Dalgaard wrote:
> Rolf Turner wrote:
>
>> P.S. ***Are*** there any risks/dangers in following Christos
>> Hatzis' suggestion of simply doing
>>
>> levels(fff) <- c("U","A","S") ???
>>
> Not if the levels are right to begin with.
>
> Problems only arise if fff s
On 4/10/2007, at 8:29 AM, Peter Dalgaard wrote:
> Rolf Turner wrote:
>> P.S. ***Are*** there any risks/dangers in following Christos
>> Hatzis' suggestion of simply doing
>>
>> levels(fff) <- c("U","A","S") ???
> Not if the levels are right to begin with.
>
> Problems onl
Rolf Turner wrote:
> P.S. ***Are*** there any risks/dangers in following Christos
> Hatzis' suggestion of simply doing
>
> levels(fff) <- c("U","A","S") ???
Not if the levels are right to begin with.
Problems only arise if fff somehow becomes a two-level factor, e.g. if
yo
verride this behavior, you will have to deal with the
sorting problem, as Peter suggested.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
> Sent: Wednesday, October 03, 2007 4:12 PM
> To: Peter Dalgaard
> Cc: r
On 4/10/2007, at 7:50 AM, Peter Dalgaard wrote:
> Rolf Turner wrote:
>>> Does it even work? (What if it is the first or the 2nd level that
>>> is absent?
>>
>> Yes it works. What's the problem?
>>
>> To beat it to death: if the second level of fff is absent
>> then fff will consist
Rolf Turner wrote:
>> Does it even work? (What if it is the first or the 2nd level that is
>> absent?
>
> Yes it works. What's the problem?
>
> To beat it to death: if the second level of fff is absent then
> fff will consist entirely of 1's and 3's,
> and so c("U","A","S")[fff] wil
On 3/10/2007, at 5:10 PM, Christos Hatzis wrote:
> Would
>
> levels(fff) <- c("A","S","U")
>
> not work?
Well, not quite. This would scramble the levels. The levels of the
original fff are
c("Unit","Achieved","Scholarship") --- i.e. they are ***not*** in
alphabetical order
On 3/10/2007, at 5:48 PM, Peter Dalgaard wrote:
> Rolf Turner wrote:
>> I have factors with levels ``Unit", "Achieved", and "Scholarship";
>> I wish to replace these with
>> "U", "A", and "S".
>>
>> So I do
>>
>> fff <- factor(fff,labels=c("U","A","S"))
>>
>> This works as long as all of
On 03-Oct-07 04:57:33, Rolf Turner wrote:
> I have factors with levels ``Unit", "Achieved", and "Scholarship"; I
> wish to replace these with
> "U", "A", and "S".
>
> So I do
>
> fff <- factor(fff,labels=c("U","A","S"))
>
> This works as long as all of the levels are actually present in
Rolf Turner wrote:
> I have factors with levels ``Unit", "Achieved", and "Scholarship"; I
> wish to replace these with
> "U", "A", and "S".
>
> So I do
>
> fff <- factor(fff,labels=c("U","A","S"))
>
> This works as long as all of the levels are actually present in the
> factor. But if ``
Would
levels(fff) <- c("A","S","U")
not work? Can you send an example?
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
> Sent: Wednesday, October 03, 2007 12:58 AM
> To: r-h
I have factors with levels ``Unit", "Achieved", and "Scholarship"; I
wish to replace these with
"U", "A", and "S".
So I do
fff <- factor(fff,labels=c("U","A","S"))
This works as long as all of the levels are actually present in the
factor. But if ``Scholarship'' is absent
(as if of
If you don't know ahead of time how many columns you have and
only that they are a mix of numeric and character (to be converted to
factor) then you can do this:
DF <- read.table(textConnection(Input), header = TRUE, as.is = TRUE)
f <- function(x) if (is.character(x)) factor(x, levels = unique(x))
Hi Gabor,
I am coming back to you about the method you described to me a month ago
to define the level order during a read.table call. I initially thought
that I would need to apply the 'unique' function on a single column of
my dataset, so I only used it after the read.table step (to make my l
23 matches
Mail list logo