Skip to content
Prev 369895 / 398506 Next

Help

As Chris points out, we do not know what the factor labels were before you tried to change them. The levels() function should have worked as long as it included all of the factor levels in the same order. The names() function lists the names of an object. For a data frame that is the column headings. Vectors like ind.davis$Ageclass do not have names:
'data.frame':   10 obs. of  2 variables:
 $ ID      : int  1 2 3 4 5 6 7 8 9 10
 $ Ageclass: Factor w/ 3 levels "A","J","S": 3 3 1 3 2 2 3 1 2 3
[1] "A" "J" "S"
NULL
[1] "ID"       "Ageclass"
[1] "Adult"     "Juvenile"  "Sub-adult"
'data.frame':   10 obs. of  2 variables:
 $ ID      : int  1 2 3 4 5 6 7 8 9 10
 $ Ageclass: Factor w/ 3 levels "Adult","Juvenile",..: 3 3 1 3 2 2 3 1 2 3


-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Christopher W Ryan
Sent: Tuesday, June 20, 2017 8:23 AM
To: R-help <r-help at r-project.org>
Subject: Re: [R] Help

Leonardo--

R-help can be a very useful resource. Some suggestions to use it well:

1. use an informative subject line, not "help"
2. include a "minimal working example:" a *little* data, the code that,
with those data, reproduces your problem, and the error message that
resulted.

As to your particular question, at this point I can only guess, but for
starters it would probably help to show the output of

str(ind.davis)

--Chris Ryan

On Tue, Jun 20, 2017 at 1:06 AM, Leonardo Malaguti <
leonardomalaguti27 at gmail.com> wrote:

            
______________________________________________
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.