Re: [R] how can I delete rows?

2006-07-20 Thread Daniele Medri
Il giorno mar, 18/07/2006 alle 12.25 -0300, raul sanchez ha scritto:
 how can I select the countries of Lat. Am. thank you

hint: add to the data.frame a column with the continental ID so this
could be usefull for other needs.

hint: ?subset



--
Daniele Medri

__
R-help@stat.math.ethz.ch mailing list
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] how can I delete rows?

2006-07-19 Thread raul sanchez
Hello, I am very new in R so I am so sorry for this question.
  I have the Barro-Lee data set which contains 98 countries and I want to run 
the regressions only for the Latin America countries, so what do you recomend? 
How can I delete all the other countries or how can I select the countries of 
Lat. Am. thank you
   
  this is the list of countries
  SHCODE COUNTRY  NAME   WBCTRY   (1)   (2)
_

  1Algeria  DZA  + +
  2Angola   AGO  - -
  3BeninBEN  - +
  4Botswana BWA  + +
  5Burkina Faso HVO  - -
  6Burundi  BDI  + -
  7Cameroon CMR  + +
  8Cape verde   CPV  - -
  9Central African Rep. CAF  + +
 10Chad TCD  - -
 11Comoros  COM  - -
 12CongoCOG  - +
 13EgyptEGY  + +
 14Ethiopia ETH  + -
 15GabonGAB  + -
 16Gambia   GMB  - +
 17GhanaGHA  + +
 18Guinea   GIN  - -
 19Guinea-BissauGNB  - -
 20Cote d'IvoireCIV  + -
 21KenyaKEN  + +
 22Lesotho  LSO  - +
 23Liberia  LBR  + +
 24Madagascar   MDG  + -
 25Malawi   MWI  + +
 26Mali MLI  - +
 27Mauritania   MRT  - -
 28MauritiusMUS  + +
 29Morocco  MAR  + -
 30Mozambique   MOZ  - -
 31NigerNER  - +
 32Nigeria  NGA  + -
 33Rwanda   RWA  + +
 34Senegal  SEN  + +
 35Seychelles   SYC  - -
 36Sierra Leone SLE  + +
 37Somalia  SOM  - -
 38South africa ZAF  + +
 39SudanSDN  + +
 40SwazilandSWZ  + +
 41Tanzania TZA  + +
 42Togo TGO  + +
 43Tunisia  TUN  + +
 44Uganda   UGA  + +
 45ZaireZAR  + +
 46Zambia   ZMB  + +
 47Zimbabwe ZWE  + +
 48Bahamas, The BHS  - -
 49Barbados BRB  + +
 50Canada   CAN  + +
 51Costa Rica   CRI  + +
 52Dominica DMA  - -
 53Dominican Rep.   DOM  + +
 54El Salvador  SLV  + +
 55Grenada  GRD  - -
 56GuatemalaGTM  + +
 57HaitiHTI  + +
 58Honduras HND  + +
 59Jamaica  JAM  + +
 60Mexico   MEX  + +
 61NicaraguaNIC  + +
 62Panama   PAN  + +
 63St.Lucia LCA  - -
 64St.Vincent  Grens.  VCT  - -
 65Trinidad  TobagoTTO  + +
 66United StatesUSA  + +
 67ArgentinaARG  + +
 68Bolivia  BOL  + +
 69Brazil   BRA  + +
 70ChileCHL  + +
 71Colombia COL  + +
 72Ecuador  ECU  + +
 73Guyana   GUY  + +
 74Paraguay PRY  + +
 

Re: [R] how can I delete rows?

2006-07-19 Thread Philipp Pagel
On Tue, Jul 18, 2006 at 12:25:47PM -0300, raul sanchez wrote:
   I have the Barro-Lee data set which contains 98 countries and I want
   to run the regressions only for the Latin America countries, so what
   do you recomend? How can I delete all the other countries or how can
   I select the countries of Lat. Am. thank you

   this is the list of countries
   SHCODE COUNTRY  NAME   WBCTRY   (1)   (2)
 _
 
   1Algeria  DZA  + +
   2Angola   AGO  - -
   3BeninBEN  - +
   4Botswana BWA  + +
   5Burkina Faso HVO  - -
   6Burundi  BDI  + -
   7Cameroon CMR  + +
[...]


Assuming the data is stored in a data frame called bl you could do
something like this:

First you generate a list of all countries you are interested in - e.g.

 set = c('Benin', 'Congo', 'Mali')


And then you subset the data frame with it

 bl[bl$COUNTRY %in% set, ]
   SHCODE COUNTRY NAME WBCTRY X.1. X.2.
3   3   Benin  BEN  -+   NA
12 12   Congo  COG  -+   NA
26 26Mali  MLI  -+   NA


cu
Philipp

-- 
Dr. Philipp PagelTel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS  Tel.  +49-89-3187 3675
GSF - National Research Center   Fax.  +49-89-3187 3585
  for Environment and Health
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

__
R-help@stat.math.ethz.ch mailing list
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.