vector(mode="logical", length=0) is.vector(x, mode="any") as.vector(x, mode="any")
is.vector returns TRUE if x is a simple object of the mode specified, and FALSE otherwise. If the mode is "any", any simple object will match, that is, an object with no attributes. Note that a list is typically a vector in this sense.
as.vector returns an object of the same length as x and with data resulting from coercing the elements of x to the specified mode. For most simple objects, the return value is simply x. If the specified mode is "numeric", the return value has storage mode "double". If the specified mode is "any", the effect is simply to remove any attributes of x in the result.
There is a difference between coercing to a simple object and setting the mode attribute: mode(x) <- mode(y) This changes the mode of x but leaves all other attributes unchanged (so a matrix stays a matrix). The value of as.vector(x,mode(y)) would have no attributes. Similarly, is.vector would return FALSE for a matrix.
vector("list", 10) # list of length 10, initialized to null elements. as.vector(x, mode(y)) # make a simple object of same mode as y is.vector(list(1:3)) # returns TRUE is.vector(matrix(NA,2,3)) # returns FALSE