Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Stata and R


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: Stata and R
Date   Tue, 25 Aug 2009 17:35:32 +0100

The Mata functions -select()- and -length()- are closest in spirit. For example:
*********************************
sysuse auto, clear
mata
st_view(X=.,., ("price", "mpg", "weight", "length"))
Y = select(X, X[., 1]:>mean(X[.,1]))
length(Y)
end
*********************************
keeps the rows of the data matrix for which the price of the car is
greater than the mean.

T

On Tue, Aug 25, 2009 at 5:12 PM, Frank Peter<[email protected]> wrote:
> Dear Statalister,
>
> Please, I am new to Stata, I am trying to replicate some R commands in Stata. I will like to know the equivalent of length and subset in Stata.
>
> Thanks.
>
> Frank
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index