[Rd] [R] R is creating a new level which is emty after importing a SAS file
peter dalgaard
pd@lgd @ending from gm@il@com
Wed Jul 4 23:09:15 CEST 2018
It is not obvious that this is an error. If your nominal variable in SAS has a level which is not present in data, then R might just be making a faithful translation. There is a distinction between (a) having a gender variable with two levels of which 0 females and (b) pretending that male is the only possible gender.
Anyways, droplevels() is your friend. (Notice that it easier to remove levels that you do not want than to insert levels that have been unwantedly deleted on input.)
-pd
> On 4 Jul 2018, at 19:16 , Adam Z. Jabir <Adam.Z.Jabir using outlook.fr> wrote:
>
> Hi,
>
> I have imported some sasdata into R using the sas7bdat package. I have some nominal variables with some missing values.
>
> R is creating a new level which is emty �.When I ask for tabulate this new level is presented with 0 as a frequency.
>
> I want to get rid of this level and have my file imported correctly.
>
> Do you have some hint to help solve this problem?
>
>
> Please use this email adress to answer this query.
>
>
> Best,
>
> Adam
>
>
> Envoy� � partir de Outlook<http://aka.ms/weboutlook>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk Priv: PDalgd using gmail.com
More information about the R-devel
mailing list