Re: [R] Importint stata file and using value labels

2016-09-01 Thread Juan Ceccarelli Arias
I solved this problem using the
nonint.factors=F,generate.factors=F)
when i imported the dta files.
Thanks to all. My issue can be declared as solved.


On Sat, Aug 27, 2016 at 12:55 PM, Michael Friendly 
wrote:

> On 8/26/2016 11:05 AM, Juan Ceccarelli Arias wrote:
>
>> Yep. Im a bit stalled.
>> I can't find the option to import only the values and drop the value
>> labels
>> from the dta file.
>> Im quite sure R can do that. Then i'd only used the values and i'd rely on
>> my memory.
>> It isn't a bad alternative.
>>
>>
> Hint: use str() to see the class of what you've read.
> Then try as.data.frame() on the resulting object read from the .dta file.
>
>
> --
> Michael Friendly Email: friendly AT yorku DOT ca
> Professor, Psychology Dept. & Chair, Quantitative Methods
> York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
> 4700 Keele StreetWeb:   http://www.datavis.ca
> Toronto, ONT  M3J 1P3 CANADA
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-27 Thread Robert Baer
There has been some good advice not to lose the labels, but perhaps this 
gets you where you seem determined to go?


?read.dta

read.dta(file, convert.dates = TRUE, convert.factors = TRUE,
 missing.type = FALSE,
 convert.underscore = FALSE, warn.missing.labels = TRUE)

or

library(readstata13)

?read.dta13

read.dta13(file, convert.factors = TRUE, generate.factors = FALSE,
  encoding = NULL, fromEncoding = NULL, convert.underscore = FALSE,
  missing.type = FALSE, convert.dates = TRUE, replace.strl = FALSE,
  add.rownames = FALSE, nonint.factors = FALSE)

Perhaps the convert. factors setting at FALSE?


On 08/27/2016 10:55 AM, Michael Friendly wrote:

On 8/26/2016 11:05 AM, Juan Ceccarelli Arias wrote:

Yep. Im a bit stalled.
I can't find the option to import only the values and drop the value 
labels

from the dta file.
Im quite sure R can do that. Then i'd only used the values and i'd 
rely on

my memory.
It isn't a bad alternative.



Hint: use str() to see the class of what you've read.
Then try as.data.frame() on the resulting object read from the .dta file.




__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-27 Thread Michael Friendly

On 8/26/2016 11:05 AM, Juan Ceccarelli Arias wrote:

Yep. Im a bit stalled.
I can't find the option to import only the values and drop the value labels
from the dta file.
Im quite sure R can do that. Then i'd only used the values and i'd rely on
my memory.
It isn't a bad alternative.



Hint: use str() to see the class of what you've read.
Then try as.data.frame() on the resulting object read from the .dta file.


--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-26 Thread Juan Ceccarelli Arias
Yep. Im a bit stalled.
I can't find the option to import only the values and drop the value labels
from the dta file.
Im quite sure R can do that. Then i'd only used the values and i'd rely on
my memory.
It isn't a bad alternative.


On Fri, Aug 26, 2016 at 4:11 AM, PIKAL Petr <petr.pi...@precheza.cz> wrote:

> Hi
>
> You can use
>
> as.numeric(sex)
>
> to get numeric values for factor variable. This is sometimes handy for
> plotting.
>
> However if you throw away labels how do you know what naumber belongs to
> which factor level?
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Juan
> > Ceccarelli Arias
> > Sent: Thursday, August 25, 2016 9:15 PM
> > To: ruipbarra...@sapo.pt
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Importint stata file and using value labels
> >
> > Mmm...The other option working with  R for importing the dta file but
> > obtaining the values and deleting or ignoring the value labels.
> > I think some time ago i did that, but now i can't remember it.
> >
> >
> > On Thu, Aug 25, 2016 at 4:11 PM, <ruipbarra...@sapo.pt> wrote:
> >
> > > So you should do
> > >
> > > table(region[sex=="Hombre"],type[sex=="Hombre"]
> > >
> > > Rui Barradas
> > >
> > >
> > > Citando Juan Ceccarelli Arias <jfca...@gmail.com>:
> > >
> > > str(sex)
> > >>>
> > >>  Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...
> > >>   On Thu, Aug 25, 2016 at 1:42 PM, <ruipbarra...@sapo.pt> wrote:
> > >>
> > >>> _Maybe sex is a factor and Man its label. Factors are coded
> > >>> internally as integers, to see it use
> > >>>
> > >>> str(sex)
> > >>>
> > >>> Rui Barradas
> > >>>  _
> > >>>
> > >>> _Citando Juan Ceccarelli Arias <jfca...@gmail.com>:_
> > >>>
> > >>> _Nop. I didn't work. But using the following it does work.
> > >>>> table(region[sex=="Men"],type[sex=="Men"])_
> > >>>> _When i use the dta file with stata i declare the condition with
> > >>>> sex==1 and not sex=="Man"._ _  _ _On Thu, Aug 25, 2016 at 12:39 PM,
> > >>>> <ruipbarra...@sapo.pt> wrote: _
> > >>>>
> > >>>>> __Hello,
> > >>>>>
> > >>>>> Try instead
> > >>>>>
> > >>>>> table(region[sex==1],type[sex=_=1])
> > >>>>>
> > >>>>> To test for equality use == not =.
> > >>>>>
> > >>>>> Hope this helps,
> > >>>>>
> > >>>>> Rui Barradas
> > >>>>>  _
> > >>>>>
> > >>>>> __Citando Juan Ceccarelli Arias <jfca...@gmail.com>:__
> > >>>>>
> > >>>>> _ _
> > >>>>>> __Hi
> > >>>>>> Im a bit lost.
> > >>>>>> Ive imported a stata13 file. When i try to make a simple
> > >>>>>> table(region[sex=1],type[sex=_1]) i get something as
> > >>>>>>   type1 type2
> > >>>>>> region1 0 0
> > >>>>>> region2 0 0
> > >>>>>> region3 0 0
> > >>>>>>
> > >>>>>> I don't know how to operate with the value labels.
> > >>>>>> Sex is defined as 1 as "Man" and 2 as "Female".
> > >>>>>> And region1 is 1, region2 is 2 and so on.
> > >>>>>> So, how can i make reference to the value and not the value
> > >>>>>> labels when i write down some condition or statement ?
> > >>>>>> I know is simple, but using the help for readstata13 didn't
> > >>>>>> clarify it to me.
> > >>>>>> Thanks for your help and time.
> > >>>>>>  _
> > >>>>>>
> > >>>>>> __[[alternative HTML version deleted]]
> > >>>>>>
> > >>>>>> ___
> > >>>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > >>>>>> https://stat.ethz.ch/

Re: [R] Importint stata file and using value labels

2016-08-26 Thread PIKAL Petr
Hi

You can use

as.numeric(sex)

to get numeric values for factor variable. This is sometimes handy for plotting.

However if you throw away labels how do you know what naumber belongs to which 
factor level?

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Juan
> Ceccarelli Arias
> Sent: Thursday, August 25, 2016 9:15 PM
> To: ruipbarra...@sapo.pt
> Cc: r-help@r-project.org
> Subject: Re: [R] Importint stata file and using value labels
>
> Mmm...The other option working with  R for importing the dta file but
> obtaining the values and deleting or ignoring the value labels.
> I think some time ago i did that, but now i can't remember it.
>
>
> On Thu, Aug 25, 2016 at 4:11 PM, <ruipbarra...@sapo.pt> wrote:
>
> > So you should do
> >
> > table(region[sex=="Hombre"],type[sex=="Hombre"]
> >
> > Rui Barradas
> >
> >
> > Citando Juan Ceccarelli Arias <jfca...@gmail.com>:
> >
> > str(sex)
> >>>
> >>  Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...
> >>   On Thu, Aug 25, 2016 at 1:42 PM, <ruipbarra...@sapo.pt> wrote:
> >>
> >>> _Maybe sex is a factor and Man its label. Factors are coded
> >>> internally as integers, to see it use
> >>>
> >>> str(sex)
> >>>
> >>> Rui Barradas
> >>>  _
> >>>
> >>> _Citando Juan Ceccarelli Arias <jfca...@gmail.com>:_
> >>>
> >>> _Nop. I didn't work. But using the following it does work.
> >>>> table(region[sex=="Men"],type[sex=="Men"])_
> >>>> _When i use the dta file with stata i declare the condition with
> >>>> sex==1 and not sex=="Man"._ _  _ _On Thu, Aug 25, 2016 at 12:39 PM,
> >>>> <ruipbarra...@sapo.pt> wrote: _
> >>>>
> >>>>> __Hello,
> >>>>>
> >>>>> Try instead
> >>>>>
> >>>>> table(region[sex==1],type[sex=_=1])
> >>>>>
> >>>>> To test for equality use == not =.
> >>>>>
> >>>>> Hope this helps,
> >>>>>
> >>>>> Rui Barradas
> >>>>>  _
> >>>>>
> >>>>> __Citando Juan Ceccarelli Arias <jfca...@gmail.com>:__
> >>>>>
> >>>>> _ _
> >>>>>> __Hi
> >>>>>> Im a bit lost.
> >>>>>> Ive imported a stata13 file. When i try to make a simple
> >>>>>> table(region[sex=1],type[sex=_1]) i get something as
> >>>>>>   type1 type2
> >>>>>> region1 0 0
> >>>>>> region2 0 0
> >>>>>> region3 0 0
> >>>>>>
> >>>>>> I don't know how to operate with the value labels.
> >>>>>> Sex is defined as 1 as "Man" and 2 as "Female".
> >>>>>> And region1 is 1, region2 is 2 and so on.
> >>>>>> So, how can i make reference to the value and not the value
> >>>>>> labels when i write down some condition or statement ?
> >>>>>> I know is simple, but using the help for readstata13 didn't
> >>>>>> clarify it to me.
> >>>>>> Thanks for your help and time.
> >>>>>>  _
> >>>>>>
> >>>>>> __[[alternative HTML version deleted]]
> >>>>>>
> >>>>>> ___
> >>>>>> R-help@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/posti
> >>>>>> ng-guide.htmland provide commented, minimal, self-contained,
> >>>>>> reproducible code. _ _ _ _ _
> >>>>>>
> >>>>>
> >>>>> __ __
> >>>>>
> >>>>
> >>>> _ _
> >>>> _ _
> >>>>
> >>>
> >>> _ _
> >>>
> >>
> >
> >
> >
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] Importint stata file and using value labels

2016-08-25 Thread Juan Ceccarelli Arias
Mmm...The other option working with  R for importing the dta file but
obtaining the values and deleting or ignoring the value labels.
I think some time ago i did that, but now i can't remember it.


On Thu, Aug 25, 2016 at 4:11 PM,  wrote:

> So you should do
>
> table(region[sex=="Hombre"],type[sex=="Hombre"]
>
> Rui Barradas
>
>
> Citando Juan Ceccarelli Arias :
>
> str(sex)
>>>
>>  Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...
>>   On Thu, Aug 25, 2016 at 1:42 PM,  wrote:
>>
>>> _Maybe sex is a factor and Man its label. Factors are coded internally
>>> as integers, to see it use
>>>
>>> str(sex)
>>>
>>> Rui Barradas
>>>  _
>>>
>>> _Citando Juan Ceccarelli Arias :_
>>>
>>> _Nop. I didn't work. But using the following it does work.
 table(region[sex=="Men"],type[sex=="Men"])_
 _When i use the dta file with stata i declare the condition with sex==1
 and not sex=="Man"._
 _  _ _On Thu, Aug 25, 2016 at 12:39 PM,  wrote: _

> __Hello,
>
> Try instead
>
> table(region[sex==1],type[sex=_=1])
>
> To test for equality use == not =.
>
> Hope this helps,
>
> Rui Barradas
>  _
>
> __Citando Juan Ceccarelli Arias :__
>
> _ _
>> __Hi
>> Im a bit lost.
>> Ive imported a stata13 file. When i try to make a simple
>> table(region[sex=1],type[sex=_1])
>> i get something as
>>   type1 type2
>> region1 0 0
>> region2 0 0
>> region3 0 0
>>
>> I don't know how to operate with the value labels.
>> Sex is defined as 1 as "Man" and 2 as "Female".
>> And region1 is 1, region2 is 2 and so on.
>> So, how can i make reference to the value and not the value labels
>> when i
>> write down some condition or statement ?
>> I know is simple, but using the help for readstata13 didn't clarify
>> it to
>> me.
>> Thanks for your help and time.
>>  _
>>
>> __[[alternative HTML version deleted]]
>>
>> ___
>> R-help@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/posti
>> ng-guide.htmland provide commented, minimal, self-contained,
>> reproducible code. _
>> _ _
>> _ _
>>
>
> __ __
>

 _ _
 _ _

>>>
>>> _ _
>>>
>>
>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-25 Thread Juan Ceccarelli Arias
> str(sex)
 Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...

On Thu, Aug 25, 2016 at 1:42 PM,  wrote:

> Maybe sex is a factor and Man its label. Factors are coded internally as
> integers, to see it use
>
> str(sex)
>
> Rui Barradas
>
>
> Citando Juan Ceccarelli Arias :
>
> Nop. I didn't work. But using the following it does work.
> table(region[sex=="Men"],type[sex=="Men"])
> When i use the dta file with stata i declare the condition with sex==1 and
> not sex=="Man".
>
> On Thu, Aug 25, 2016 at 12:39 PM,  wrote:
>>
>>
>>
>>
>>
>> *Hello, Try instead table(region[sex==1],type[sex=*=1])
>>
>> To test for equality use == not =.
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>>
>> *Citando Juan Ceccarelli Arias >:*
>>
>>
>>
>>
>>
>> *Hi Im a bit lost. Ive imported a stata13 file. When i try to make a
>> simple table(region[sex=1],type[sex=*1])
>> i get something as
>>   type1 type2
>> region1 0 0
>> region2 0 0
>> region3 0 0
>>
>> I don't know how to operate with the value labels.
>> Sex is defined as 1 as "Man" and 2 as "Female".
>> And region1 is 1, region2 is 2 and so on.
>> So, how can i make reference to the value and not the value labels when i
>> write down some condition or statement ?
>> I know is simple, but using the help for readstata13 didn't clarify it to
>> me.
>> Thanks for your help and time.
>>
>>
>>
>> *[[alternative HTML version deleted]]
>> __*
>> R-help@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/posti
>> ng-guide.htmland provide commented, minimal, self-contained,
>> reproducible code.
>>
>>
>>
>>
>>
>>
>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-25 Thread ruipbarradas

So you should do

table(region[sex=="Hombre"],type[sex=="Hombre"]

Rui Barradas
 

Citando Juan Ceccarelli Arias :


str(sex)

 Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...
  On Thu, Aug 25, 2016 at 1:42 PM,  wrote:
_Maybe sex is a factor and Man its label. Factors are coded  
internally as integers, to see it use


str(sex)

Rui Barradas
 _

_Citando Juan Ceccarelli Arias :_


_Nop. I didn't work. But using the following it does work.
table(region[sex=="Men"],type[sex=="Men"])_
_When i use the dta file with stata i declare the condition with  
sex==1 and not sex=="Man"._

_  _ _On Thu, Aug 25, 2016 at 12:39 PM,  wrote: _

__Hello,

Try instead

table(region[sex==1],type[sex=_=1])

To test for equality use == not =.

Hope this helps,

Rui Barradas
 _

__Citando Juan Ceccarelli Arias :__


_ _
__Hi
Im a bit lost.
Ive imported a stata13 file. When i try to make a simple
table(region[sex=1],type[sex=_1])
i get something as
          type1 type2
region1 0 0
region2 0 0
region3 0 0

I don't know how to operate with the value labels.
Sex is defined as 1 as "Man" and 2 as "Female".
And region1 is 1, region2 is 2 and so on.
So, how can i make reference to the value and not the value labels when i
write down some condition or statement ?
I know is simple, but using the help for readstata13 didn't clarify it to
me.
Thanks for your help and time.
 _

__        [[alternative HTML version deleted]]

___
R-help@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.htmland provide  
commented, minimal, self-contained, reproducible code. _

_ _
_ _


__ __


_ _
_ _


_ _


 

__
R-help@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.

Re: [R] Importint stata file and using value labels

2016-08-25 Thread Jeff Newmiller
You need to (re-)read the "Introduction to R" document that comes with R. R Is 
not Stata, and you should not expect R to look syntactically like Stata.

Note that if you, against normal R convention, wish to manipulate the integers 
that a factor is implemented with,  you can create such a variable using 
as.integer( sex ), but beware that bad data or changes made to the factor 
definition before your analysis step will render your assumptions about 
specific integer values invalid. For example the order of levels for sex might 
go c("M","F") or c("F","M") so 1 could mean different things based on decisions 
made elsewhere. 
-- 
Sent from my phone. Please excuse my brevity.

On August 25, 2016 5:09:42 AM PDT, Juan Ceccarelli Arias  
wrote:
>Hi
>Im a bit lost.
>Ive imported a stata13 file. When i try to make a simple
>table(region[sex=1],type[sex=1])
>i get something as
>   type1 type2
>region1 0 0
>region2 0 0
>region3 0 0
>
>I don't know how to operate with the value labels.
>Sex is defined as 1 as "Man" and 2 as "Female".
>And region1 is 1, region2 is 2 and so on.
>So, how can i make reference to the value and not the value labels when
>i
>write down some condition or statement ?
>I know is simple, but using the help for readstata13 didn't clarify it
>to
>me.
>Thanks for your help and time.
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-25 Thread ruipbarradas
Maybe sex is a factor and Man its label. Factors are coded internally  
as integers, to see it use

str(sex)

Rui Barradas
 

Citando Juan Ceccarelli Arias :

> Nop. I didn't work. But using the following it does work.
> table(region[sex=="Men"],type[sex=="Men"])
> When i use the dta file with stata i declare the condition with  
> sex==1 and not sex=="Man".
>   On Thu, Aug 25, 2016 at 12:39 PM,  wrote:
>> _Hello,
>>
>> Try instead
>>
>> table(region[sex==1],type[sex==1])
>>
>> To test for equality use == not =.
>>
>> Hope this helps,
>>
>> Rui Barradas
>>  _
>>
>> _Citando Juan Ceccarelli Arias :_
>>
>>>  
>>> _Hi
>>> Im a bit lost.
>>> Ive imported a stata13 file. When i try to make a simple
>>> table(region[sex=1],type[sex=1])
>>> i get something as
>>>           type1 type2
>>> region1 0 0
>>> region2 0 0
>>> region3 0 0
>>>
>>> I don't know how to operate with the value labels.
>>> Sex is defined as 1 as "Man" and 2 as "Female".
>>> And region1 is 1, region2 is 2 and so on.
>>> So, how can i make reference to the value and not the value labels when i
>>> write down some condition or statement ?
>>> I know is simple, but using the help for readstata13 didn't clarify it to
>>> me.
>>> Thanks for your help and time._
>>>  
>>>
>>> _        [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@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.htmland provide commented,  
>>> minimal, self-contained, reproducible code._
>>>  
>>
>> _ _

 

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Importint stata file and using value labels

2016-08-25 Thread Juan Ceccarelli Arias
Nop. I didn't work. But using the following it does work.
table(region[sex=="Men"],type[sex=="Men"])
When i use the dta file with stata i declare the condition with sex==1 and
not sex=="Man".

On Thu, Aug 25, 2016 at 12:39 PM,  wrote:

> Hello,
>
> Try instead
>
> table(region[sex==1],type[sex==1])
>
> To test for equality use == not =.
>
> Hope this helps,
>
> Rui Barradas
>
>
> Citando Juan Ceccarelli Arias :
>
> Hi
> Im a bit lost.
> Ive imported a stata13 file. When i try to make a simple
> table(region[sex=1],type[sex=1])
> i get something as
>   type1 type2
> region1 0 0
> region2 0 0
> region3 0 0
>
> I don't know how to operate with the value labels.
> Sex is defined as 1 as "Man" and 2 as "Female".
> And region1 is 1, region2 is 2 and so on.
> So, how can i make reference to the value and not the value labels when i
> write down some condition or statement ?
> I know is simple, but using the help for readstata13 didn't clarify it to
> me.
> Thanks for your help and time.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.htmland provide commented, minimal, self-contained,
> reproducible code.
>
>
>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Importint stata file and using value labels

2016-08-25 Thread ruipbarradas
Hello,

Try instead

table(region[sex==1],type[sex==1])

To test for equality use == not =.

Hope this helps,

Rui Barradas
 

Citando Juan Ceccarelli Arias :

> Hi
> Im a bit lost.
> Ive imported a stata13 file. When i try to make a simple
> table(region[sex=1],type[sex=1])
> i get something as
>           type1 type2
> region1 0 0
> region2 0 0
> region3 0 0
>
> I don't know how to operate with the value labels.
> Sex is defined as 1 as "Man" and 2 as "Female".
> And region1 is 1, region2 is 2 and so on.
> So, how can i make reference to the value and not the value labels when i
> write down some condition or statement ?
> I know is simple, but using the help for readstata13 didn't clarify it to
> me.
> Thanks for your help and time.
>
>         [[alternative HTML version deleted]]
>
> __
> R-help@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.htmland provide commented,  
> minimal, self-contained, reproducible code.

 

[[alternative HTML version deleted]]

__
R-help@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.