[R] Dummies in R

Matej Cepl cepl at surfbest.net
Thu Apr 29 16:12:04 CEST 2004


On Thursday 29 of April 2004 07:49, Susana Bird wrote:
> my problem is following. I know Stata, but currently I have to 
use R. Could You please help in finding the analogy to R.

I am too clueless about Stata, but I have another hint (check 
"Introduction to R" whether I have guessed correctly for what 
you want to do):

> g byte city=0

I have no clue what does it is supposed to mean (initialize city 
with zeroes? But how can you test for its value then?).

> replace city=1 if city==12&year==2000

What about this?

	city <- city[city == "12" & year == "2000"]

Take a look at this example:

	> city <- cbind(rnorm(100,50,10),0)
	> city
	> city[,2] <- as.logical(city[,1]<"50")
	> city

Does it make any sense to you?

	Matěj

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
A modest little person, with much to be modest about.
      -- Winston Churchill




More information about the R-help mailing list