[R-sig-Geo] help for select two columns in a data frame

Kamran Safi ksafi at orn.mpg.de
Fri Mar 6 07:04:45 CET 2009


Hi,

sample_real <- sample[, c(2,4)]
writeOGR(sample_real, ".", "sample_real", driver="ESRI Shapefile")

should do the job.

Kami


gianni lavaredo wrote:
> sorry for the easy questions but I have this problem. I had read Help but I
> didn't find this question. Sorry for desturbing but I am a brand new in R,
> sorry again
>
> # I have a shape file with 4 column (soil, ID, country, pH)
>
> sample <- readOGR(".", "sample")
> summary("sample")
> # I wish select only the ID (2 column) and pH (4 column)
> # in help I found this sw[1:3] for select the 1°,2°,3° columns, but I wish
> to select only the
> # 2° and 4°
>
> sample_real <- sample[?????]
> writeOGR(sample_real, ".", "sample_real", driver="ESRI Shapefile")
>
> thanks and sorry again for the question and for your time
>
> Gianni
>
>
> sampe <-
>
> 	[[alternative HTML version deleted]]
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3275 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090306/902920c4/attachment.bin>


More information about the R-sig-Geo mailing list