character(length=0) is.character(x) as.character(x)
is.character returns TRUE if x has mode "character", and FALSE otherwise. Its behavior is unaffected by any attributes of x; for example, x could be a character array (in contrast to the behavior of is.vector).
as.character returns x if x is a simple object of mode "character", and otherwise a character vector of the same length as x and with data resulting from coercing the elements of x to mode "character".
Simple objects have no attributes. Data elements of objects of mode "character" are character strings. In most S-PLUS expressions it is not necessary to explicitly ensure that data are of a particular mode. For example, the function paste does not need character arguments; it will coerce data to character as needed.
Note the difference between coercing to a simple object of mode "character" and setting the mode attribute: mode(myobject) <- "character" This changes the mode of myobject but leaves all other attributes unchanged (so, for example, a matrix stays a matrix). On the other hand, the value of as.character(myobject) has no attributes.
character(length(zz)) # a character object the same length as zz as.character(1:10) # character representations of 1,2,...,10