Remove the "" around the options. You also have to put it in a sapply, as
switch only works on single values. But I wouldn't call this optimal...

elevation.DM <-sapply(Population,switch, CO= 2169, CN = 1121,
                                 Ga =500, KO = 2500, Mw = 625, Ng = 300 )

Cheers
Joris


On Wed, May 26, 2010 at 9:04 PM, Ian Dworkin <idworkin@msu.edu> wrote:

>
> # Dennis Murphy suggested switch.. I have not gotten it working yet..
>
> elevation.DM <- switch(Population, "CO"= 2169, "CN" = 1121, "Ga" =
> 500, "KO" = 2500, "Mw" = 625, "Ng" = 300 )
>
>
>
>
>
> --
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
Joris.Meys@Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]

