Union find
Union find

Reputation: 8160

How to convert two variables (integers) to a double in R?

I have never used R before and haven't found good docs on is.numeric() or double() online.

Very simply, I am trying to take two integers and put them in a double, which I want to put in a vector, which will enter as a column. I'm trying to solve the former part.

endlat <- df[i, "end.station.latitude"]
endlong <- df[i, "end.station.longitude"]
end <- as.double(endlat, endlong)

This only stores one of the values in the variable. How does this function work?

Upvotes: 0

Views: 1302

Answers (1)

Robert Krzyzanowski
Robert Krzyzanowski

Reputation: 9344

You would like

as.double(c(endlat, endlong))

This passes the integer length-2 vector containing endlat and endlong to as.double, which only takes one argument.

Upvotes: 1

Related Questions