[R] package dependency tree

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[R] package dependency tree

RKoenker
Is there a painless way to find the names of all packages on CRAN
that "Depend" on a specified package?


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    [hidden email]            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Gabor Grothendieck
Try this, noting that available.packages() returns a matrix whose columns
include "Depends" and "Suggests" and whose rownames are the package
names:

> AP <- available.packages()
> rownames(AP)[grep("quantreg", AP[, "Depends"])]
[1] "cobs"    "emplik"  "lss"     "rankreg" "rqmcmb2"
> rownames(AP)[grep("quantreg", AP[, "Suggests"])]
[1] "apTreeshape" "diveMove"    "dyn"         "ggplot"      "gsubfn"
[6] "np"

On 1/2/07, roger koenker <[hidden email]> wrote:

> Is there a painless way to find the names of all packages on CRAN
> that "Depend" on a specified package?
>
>
> url:    www.econ.uiuc.edu/~roger            Roger Koenker
> email    [hidden email]            Department of Economics
> vox:     217-333-4558                University of Illinois
> fax:       217-244-6678                Champaign, IL 61820
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Prof. Dr. Matthias Kohl
Hello,

http://bioconductor.org/packages/1.9/bioc/html/pkgDepTools.html
resp.
http://bioconductor.org/packages/2.0/bioc/html/pkgDepTools.html
may help you.

Best regards,
Matthias

Gabor Grothendieck schrieb:

> Try this, noting that available.packages() returns a matrix whose columns
> include "Depends" and "Suggests" and whose rownames are the package
> names:
>
>  
>> AP <- available.packages()
>> rownames(AP)[grep("quantreg", AP[, "Depends"])]
>>    
> [1] "cobs"    "emplik"  "lss"     "rankreg" "rqmcmb2"
>  
>> rownames(AP)[grep("quantreg", AP[, "Suggests"])]
>>    
> [1] "apTreeshape" "diveMove"    "dyn"         "ggplot"      "gsubfn"
> [6] "np"
>
> On 1/2/07, roger koenker <[hidden email]> wrote:
>  
>> Is there a painless way to find the names of all packages on CRAN
>> that "Depend" on a specified package?
>>
>>
>> url:    www.econ.uiuc.edu/~roger            Roger Koenker
>> email    [hidden email]            Department of Economics
>> vox:     217-333-4558                University of Illinois
>> fax:       217-244-6678                Champaign, IL 61820
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>    
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>  


--
Dr. rer. nat. Matthias Kohl
E-Mail: [hidden email]
Home: www.stamats.de

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Sebastian P. Luque
In reply to this post by RKoenker
On Tue, 2 Jan 2007 11:20:10 -0600,
roger koenker <[hidden email]> wrote:

> Is there a painless way to find the names of all packages on CRAN that
> "Depend" on a specified package?

Maybe this is not too painful:


pkgs <- available.packages()            # repos arg may be useful here
pkgs.dpnd <- pkgs[grep("quantreg", pkgs[, "Depends"]), ]
names(pkgs.dpnd)


--
Seb

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Peter Dalgaard
In reply to this post by RKoenker
roger koenker wrote:
> Is there a painless way to find the names of all packages on CRAN
> that "Depend" on a specified package?
>  
Depends on how accurately you need them. These *probably* depend on "boot"

> x <- available.packages()

> rownames(x)[grep("boot",x[,"Depends"])]

 [1] "circular"     "cramer"       "DCluster"     "equivalence"  "np"

 [6] "pastecs"      "relaimpo"     "sensitivity"  "simpleboot"   "spdep"

[11] "survrec"      "titan"        "verification" "Zelig"

This allows visual inspection of the Depends fields too:

x[grep("boot",x[,"Depends"]), "Depends", drop=F]    

(There could have been dependencies on, say, simpleboot). For increased precision,
you'll need to grep more carefully, for "\\<boot\\>". Finally, catching indirect
dependencies requires iterative application, something like this:

> f <- function(s) rownames(x)[grep(paste("\\<",s,"\\>",sep=""),x[,"Depends"])]
> (y <- f("boot"))
 [1] "circular"     "cramer"       "DCluster"     "equivalence"  "np"
 [6] "pastecs"      "relaimpo"     "sensitivity"  "simpleboot"   "spdep"
[11] "survrec"      "titan"        "verification" "Zelig"
> (y0 <- unlist(lapply(y,f)))
[1] "wle"      "DCluster" "svcR"     "gcmrec"   "VDCutil"
> (y0 <- setdiff(y0,y))
[1] "wle"     "svcR"    "gcmrec"  "VDCutil"
> (y <- union(y, y0))
 [1] "circular"     "cramer"       "DCluster"     "equivalence"  "np"
 [6] "pastecs"      "relaimpo"     "sensitivity"  "simpleboot"   "spdep"
[11] "survrec"      "titan"        "verification" "Zelig"        "wle"
[16] "svcR"         "gcmrec"       "VDCutil"
> (y0 <- unlist(lapply(y0,f)))
character(0)

...and stop at this point since there are no more dependents. Otherwise, repeat.  
 

--
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Brian Ripley
In reply to this post by RKoenker
On Tue, 2 Jan 2007, roger koenker wrote:

> Is there a painless way to find the names of all packages on CRAN
> that "Depend" on a specified package?

Assuming you have just CRAN in your selected repositories:

> foo <- available.packages()
> deps <- strsplit(foo[, "Depends"], ",[[:space:]]*")
> names(deps)[sapply(deps, function(x) "quantreg" %in% x)]
[1] "cobs"    "emplik"  "lss"     "pheno"   "rankreg" "rqmcmb2"

seems painless enough.

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] package dependency tree

Seth Falcon-2
In reply to this post by Prof. Dr. Matthias Kohl
Matthias Kohl <[hidden email]> writes:

> Hello,
>
> http://bioconductor.org/packages/1.9/bioc/html/pkgDepTools.html
> resp.
> http://bioconductor.org/packages/2.0/bioc/html/pkgDepTools.html
> may help you.

[shameless plug]

Last Month's RNews has an article that demonstrates the pkgDepTools
package:

[144] Seth Falcon. Modeling package dependencies using graphs. R News,
6(5):8-12, December 2006.

+ seth

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

[R] Is there a function for this?

Feng Qiu-2
In reply to this post by RKoenker
Hi everybody, I'm trying to do a statistic on the error rate of a prediction
algorithm.

suppose this is the real category
[good, good, bad, bad, good, good, bad, bad]
this is the predicted category
[good, bad, bad, bad, good, good, good, bad]

I'm trying to do a statistic on the error rate for each group("good","bad"):
what percentage of instances are predicted incorrectly for each group ?
Of course I can write a loop to do that, but is there a easy way to do that?

Thank you!

Best,

Feng

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] Is there a function for this?

Gabor Grothendieck
Try this:

> actual <- factor(c("good", "good", "bad", "bad", "good", "good", "bad", "bad"))
> pred <- factor(c("good", "bad", "bad", "bad", "good", "good", "good", "bad"))

> table(actual, pred)
      pred
actual bad good
  bad    3    1
  good   1    3

> prop.table(table(actual, pred), 1)
      pred
actual  bad good
  bad  0.75 0.25
  good 0.25 0.75

> prop.table(table(actual, pred), 2)
      pred
actual  bad good
  bad  0.75 0.25
  good 0.25 0.75

> library(gmodels)
> CrossTable(actual, pred)


   Cell Contents
|-------------------------|
|                       N |
| Chi-square contribution |
|           N / Row Total |
|           N / Col Total |
|         N / Table Total |
|-------------------------|


Total Observations in Table:  8


             | pred
      actual |       bad |      good | Row Total |
-------------|-----------|-----------|-----------|
         bad |         3 |         1 |         4 |
             |     0.500 |     0.500 |           |
             |     0.750 |     0.250 |     0.500 |
             |     0.750 |     0.250 |           |
             |     0.375 |     0.125 |           |
-------------|-----------|-----------|-----------|
        good |         1 |         3 |         4 |
             |     0.500 |     0.500 |           |
             |     0.250 |     0.750 |     0.500 |
             |     0.250 |     0.750 |           |
             |     0.125 |     0.375 |           |
-------------|-----------|-----------|-----------|
Column Total |         4 |         4 |         8 |
             |     0.500 |     0.500 |           |
-------------|-----------|-----------|-----------|





On 1/3/07, Feng Qiu <[hidden email]> wrote:

> Hi everybody, I'm trying to do a statistic on the error rate of a prediction
> algorithm.
>
> suppose this is the real category
> [good, good, bad, bad, good, good, bad, bad]
> this is the predicted category
> [good, bad, bad, bad, good, good, good, bad]
>
> I'm trying to do a statistic on the error rate for each group("good","bad"):
> what percentage of instances are predicted incorrectly for each group ?
> Of course I can write a loop to do that, but is there a easy way to do that?
>
> Thank you!
>
> Best,
>
> Feng
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [R] Is there a function for this?

Andreas Hary-2
In reply to this post by Feng Qiu-2
Try the following:

act <- c('good','good','bad','bad','good','good','bad','bad')
pred <- c('good','bad','bad','bad','good','good','good','bad')
table(pred,act)
table(pred,act)/apply(table(pred,act),1,sum)

Cheers,

Andreas


On 1/3/07, Feng Qiu <[hidden email]> wrote:

> Hi everybody, I'm trying to do a statistic on the error rate of a prediction
> algorithm.
>
> suppose this is the real category
> [good, good, bad, bad, good, good, bad, bad]
> this is the predicted category
> [good, bad, bad, bad, good, good, good, bad]
>
> I'm trying to do a statistic on the error rate for each group("good","bad"):
> what percentage of instances are predicted incorrectly for each group ?
> Of course I can write a loop to do that, but is there a easy way to do that?
>
> Thank you!
>
> Best,
>
> Feng
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.