1

I have the following data:

Longitude  Latitude

-84.68934  59.22615
-84.52940  58.79971 
-84.68617  58.97750 
-84.88737  59.08489 
-84.71777  59.14207
-84.71777  59.14207 

I'd like to add a third column:

Longitude Latitude Combined

-84.68934 59.22615 c(-84.68934,59.22615)

-84.52940 58.79971 c(-84.52940,58.7997) 

*Edit - Pasting won't work (or at least I think it won't) as I need the result to be a vector.

1 Answers1

1

Can you be more specific about what you're trying do to?

If you just want another vector,

Combined <- c(Latitude, Longitude)

will work. If you're working in a data.frame, you probably are trying to do something that shouldn't be done, since data.frame values need to be atomic instances, not vectors.

Alex Gold
  • 335
  • 1
  • 9
  • 1
    For some reason, I was always getting an error that the resulting column has twice as many rows as the data.frame when I tried this method. I was trying to get a list of Latitude and Longitude points as vector objects - c(Long, Lat) - to use as in input to a function, but I just rewrote the function to take multiple parameters and used mapply. I'd still like to know how to do this, though. – the_okay_gatsby Jun 06 '17 at 20:18