Q:

Name of the Minimum value in a named vector

I have a named vector:
v <- c("morning"=80, "noon"=20, "night"=40)

printing min(v) gives

[1] 20

I want to get this instead:

noon
      20

Is there a simple way?

A:

v[which.min(v)] will give you the output you listed. But if you just want the name, and not the value, then do names(v)[which.min(v)]. 

