xts object is a matrix plus an index, so you cannot just pass an object to boxplot() . If you look at str(xx) :
# An 'xts' object from 2013-06-07 to 2013-06-16 containing: # Data: num [1:10, 1:3] 0.321 -0.462 1.715 0.575 0.83 ... # - attr(*, "dimnames")=List of 2 # ..$ : NULL # ..$ : chr [1:3] "a" "b" "c" # Indexed by objects of class: [Date] TZ: # xts Attributes: # NULL
You can access the matrix through coredata() :
coredata(xx) # abc # [1,] 0.32120813 -0.07370657 -0.601288169 # [2,] -0.46154742 -1.09475940 3.028664653 # [3,] 1.71515544 -0.31000454 -0.009281175 # [4,] 0.57482616 -0.06260991 1.198034802 # [5,] 0.83015688 -2.49614565 -1.689812377 # [6,] 0.01748081 -0.55332675 2.391426111 # [7,] 0.69852800 -0.10337251 -0.267939285 # [8,] 0.75139113 -0.17427970 -0.561434122 # [9,] -0.68942598 0.18685817 -1.508917140 # [10,] -0.76381007 -2.44387628 0.290524821
What you can use directly, but you would use a matrix:
boxplot(coredata(xx))

If you want to use the index of the xts object, you simply use index() :
index(xx) # [1] "2013-06-07" "2013-06-08" "2013-06-09" "2013-06-10" "2013-06-11" "2013-06-12" "2013-06-13" "2013-06-14" "2013-06-15" # [10] "2013-06-16"
source share