Hello I am trying to input some co-ordinate sets into R of the form x,y by using lists. The command I am using is: p1 <- list(x=c(3445,563,646), y=c(234,567,456)) However the actual co-ordinate sets that I am trying to input have 305 points each and I think that the program will not accept a command that is as long as necessary. Is this so? If this is the case can you tell me how to read the points in as a table but so that I can call on them as being p1, later in the program? Many Thanks Louise -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Hello > > I am trying to input some co-ordinate sets into R of the form x,y byusing> lists. The command I am using is: > > p1 <- list(x=c(3445,563,646), y=c(234,567,456)) > > However the actual co-ordinate sets that I am trying to input have 305 > points each and I think that the program will not accept a commandthat is> as long as necessary. Is this so? If this is the case can you tellme how> to read the points in as a table but so that I can call on them asbeing p1,> later in the program? > > Many Thanks > LouiseOne easy way is to enter the coordinates into a text file with a text editor so that the file looks like: x y 3445 234 563 567 646 456 ... and then read into R with a statement p1 <- read.table ("file.name", header=TRUE) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Go to http://lib.stat.cmu.edu/R/CRAN/, click on the "Manual" link on the left, and get two of the documents: An Introduction to R (approx. 100 pages, 650kB), based on the former "Notes on R", gives an introduction to the language and how to use R for doing statistical analysis and graphics. R Data Import/Export (approx. 30 pages, 270kB) describes the import and export facilities available either in R itself or via packages which are available from CRAN. Briefly, put your coordinates in a plain text file (two columns, x and y, similar to a spreadsheet), and use the scan() function to read them in from the file. -Don At 4:53 PM +0100 5/8/02, Louise Cox wrote:>Hello > >I am trying to input some co-ordinate sets into R of the form x,y by using >lists. The command I am using is: > >p1 <- list(x=c(3445,563,646), y=c(234,567,456)) > >However the actual co-ordinate sets that I am trying to input have 305 >points each and I think that the program will not accept a command that is >as long as necessary. Is this so? If this is the case can you tell me how >to read the points in as a table but so that I can call on them as being p1, >later in the program? > >Many Thanks >Louise > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html >Send "info", "help", or "[un]subscribe" >(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA -------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Louise, See answer below:> > I am trying to input some co-ordinate sets into R of the form x,y by using > lists. The command I am using is: > > p1 <- list(x=c(3445,563,646), y=c(234,567,456)) > > However the actual co-ordinate sets that I am trying to input have 305 > points each and I think that the program will not accept a command that is > as long as necessary. Is this so? If this is the case can you tell me how > to read the points in as a table but so that I can call on them as being p1, > later in the program?Why not just place the points in a text file? E.g. x, y 3445, 234 563, 567 646, 456 Save the last four lines into a text file called `coords.csv' (no quotes). In R, use the commands:> p1 <- read.csv("coords.csv",header=T) > p1x y 1 3445 234 2 563 567 3 646 456> p1$x[1] 3445 563 646> p1$y[1] 234 567 456> p1.list <- as.list(p1) > p1.list$x [1] 3445 563 646 $y [1] 234 567 456>See read.csv or read.table for more details. Sundar -- Sundar Dorai-Raj, Ph.D. Statistical Methods Engineer PDF Solutions, Inc. Richardson TX (972) 889-3085 x216 (214) 392-7619 cell sundar.dorai-raj at pdf.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Maybe Matching Threads
- window (x,y) co-ordinates of datapoints
- Creating a point pattern with cartesian co-ordinates
- Spatial join between two datasets using x and y co-ordinates
- Distances between two datasets of x and y co-ordinates
- Getting individual co-ordinate points in k medoids cluster