How to find an old function from a package ?

Hi,

I want to find probably deprecated function unrowname() from plyr package. How can I do it fast without downloading many old versions of plyr and manually searching for it ?

I am reading this:
https://stackoverflow.com/questions/2714851/as-data-frame-of-table-to-summarize-frequencies

I have found ninteraction() function which is used inside that code:

tab <- function(df, drop = TRUE) {
  id <- plyr::ninteraction(df)
  ord <- order(id)

  df <- df[ord, , drop = FALSE]
  id <- id[ord]

  freq <- rle(id)$lengths
  labels <- unrowname(df[cumsum(freq), , drop = FALSE])

  data.frame(labels, freq)
}

but another one called unrowname() is needed. I can't find it so far. Any thoughts would be much appreciated, thank you.

unrowname() function is not a built-in function in R and it seems that it is not present in the plyr package anymore. It is likely that this function was removed or deprecated in a newer version of the package.

One way to find the function is to check the documentation or vignettes of the package for previous versions. You can find previous versions of plyr package on the CRAN archive website: Index of /src/contrib/Archive/plyr

Alternatively, you can try searching the source code of the package using Github's search function by searching for the function name in the repository of the package.

Lastly, you can also check the package's mailing list or forum for any discussions or issues related to the function.

@TalhaAsif is right. The function can be found here, in the repo. It looks like it does no more than

rownames(mtcars)
#>  [1] "Mazda RX4"           "Mazda RX4 Wag"       "Datsun 710"         
#>  [4] "Hornet 4 Drive"      "Hornet Sportabout"   "Valiant"            
#>  [7] "Duster 360"          "Merc 240D"           "Merc 230"           
#> [10] "Merc 280"            "Merc 280C"           "Merc 450SE"         
#> [13] "Merc 450SL"          "Merc 450SLC"         "Cadillac Fleetwood" 
#> [16] "Lincoln Continental" "Chrysler Imperial"   "Fiat 128"           
#> [19] "Honda Civic"         "Toyota Corolla"      "Toyota Corona"      
#> [22] "Dodge Challenger"    "AMC Javelin"         "Camaro Z28"         
#> [25] "Pontiac Firebird"    "Fiat X1-9"           "Porsche 914-2"      
#> [28] "Lotus Europa"        "Ford Pantera L"      "Ferrari Dino"       
#> [31] "Maserati Bora"       "Volvo 142E"
row.names(mtcars) <- NULL
rownames(mtcars)
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15"
#> [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"
#> [31] "31" "32"

Created on 2023-01-28 with reprex v2.0.2

1 Like

Yes, that's right but without it tab() function will not work.

That was helpful, I dug into it and found it. Thank you both.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.