CNSeg no method coercing S4 class to vector I'm attempting to analyze some genomic data with the help of a package called CNSeg. The package is located here and the documentation is here. 

My input data looks like:

&gt; str(segments)
'data.frame':   11897 obs. of  7 variables:
 $ X                : int  0 1 2 3 4 5 6 7 8 9 ...
 $ SegmentID        : int  72 73 74 75 76 77 78 79 80 81 ...
 $ Chromosome       : int  1 1 2 2 2 3 3 3 3 3 ...
 $ StartPosition    : int  754192 145260908 21494 141215321 141275624 63411 69812903 69884262 126473310 126790130 ...
 $ StopPosition     : int  145258178 249212878 141214996 141275051 243052331 69811900 69884106 126457276 126772699 197852564 ...
 $ Median.Log2.Ratio: num  -0.014 0.311 -0.003 0.059 -0.012 -0.018 -0.106 0.007 -0.171 0.001 ...
 $ FileName         : Factor w/ 95 levels "TSB02183","TSB02184",..: 1 1 1 1 1 1 1 1 1 1 ..


(Note: I did import the segments data with FileName as a vector instead of a factor as well. No difference in the error below).

I followed the vignette to the letter and, at the end of the vignette, the creator tells me that I can use the dist() method. When I try to use it, I get an error: Error in as.vector(data) : 
  no method for coercing this S4 class to a vector.

Here is my session information:

&gt; segments &lt;- read.csv("Probe_Segments_CN.csv")
&gt; cnseg &lt;- CNSeg(segList = segments, chromosome = "Chromosome", end = "StopPosition", start = "StartPosition", segMean = "Median.Log2.Ratio", id = "FileName")
&gt; rdseg &lt;- getRS(cnseg, by = "region", imput = FALSE, XY = FALSE, what = "mean")
Processing samples ... Done
&gt; data("geneInfo")
&gt; geneInfo &lt;- geneInfo[sample(1:nrow(geneInfo), 2000), ]
&gt; 
&gt; rdByGene &lt;- getRS(cnseg, by = "gene", imput = FALSE, XY = FALSE, geneMap = geneInfo, what = "median")
&gt; 
&gt; reducedseg &lt;- rs(rdseg)
&gt; f1 &lt;- kOverA(5, 1)
&gt; 
&gt; ffun &lt;- filterfun(f1)
&gt; 
&gt; filteredrs &lt;- genefilter(rdseg, ffun)
&gt; filteredrs &lt;- madFilter(rdseg, 0.8)
&gt; dist(filteredrs)
Error in as.vector(data) : 
  no method for coercing this S4 class to a vector
&gt; sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows &gt;= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] tools     stats     graphics  grDevices
[5] utils     datasets  methods   base     

other attached packages:
[1] CNTools_1.34.0    genefilter_1.60.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17         AnnotationDbi_1.40.0
 [3] BiocGenerics_0.24.0  splines_3.4.0       
 [5] IRanges_2.12.0       bit_1.1-14          
 [7] lattice_0.20-35      xtable_1.8-2        
 [9] blob_1.1.1           parallel_3.4.0      
[11] grid_3.4.0           Biobase_2.38.0      
[13] DBI_1.0.0            survival_2.41-3     
[15] bit64_0.9-7          digest_0.6.15       
[17] Matrix_1.2-9         S4Vectors_0.16.0    
[19] bitops_1.0-6         RCurl_1.95-4.10     
[21] memoise_1.1.0        RSQLite_2.1.1       
[23] compiler_3.4.0       stats4_3.4.0        
[25] XML_3.98-1.11        annotate_1.56.2
If you are using the latest version of Bioconductor you should always look at the latest documentation of the package in Bioconductor. There could be changes from 2011 to 2018 (In this case there aren't any changes in the section you mention).

The problem is the package doesn't define how dist should behave with that object class (filteredrs is a RS object if I read the source code well). 

You can extract the metrics to calculate the distance yourself or ask the maintainer to add this method to the class. However it could be that the maintainer answer you if you post the question in the support site of Bioconductor.