Giter Club home page Giter Club logo

Comments (12)

trinker avatar trinker commented on May 28, 2024

This is by no means complete but a test walk through of creating a data frame of packages and repo locations:

p_bioconductor <- function(URL = "http://www.bioconductor.org/packages/json/2.10/bioc/packages.js") {
    require(RJSONIO)
    require(RCurl)
    x <- getURL(URL)
    x <- substr(x, 21, nchar(x)-1)
    x <- fromJSON(x)[[1]]
    x <- data.frame(matrix(unlist(x), ncol = 3, byrow = TRUE), stringsAsFactors = FALSE)
    names(x) <- c("Package", "Maintainer", "Title")
    return(x)
}   #compliments of bryan goodrich


p_pack.loc <- function() {
    x <- p_cran()
    y <- p_bioconductor()[, 1]
    z <- p_seeRipley()
    loc <- rep(c("cran", "bio", "ripley"), c(length(x), length(y), length(z)))
    data.frame(package = c(x, y, z), location = loc, stringsAsFactors = FALSE)
}

p_packs_data <- p_pack.loc()

p_lookup <- function(package.name) {
    p_packs_data[, 2][p_packs_data[, 1] %in% package.name]
}

p_lookup("ggplot2")

from pacman.

trinker avatar trinker commented on May 28, 2024

Note: you need seeRipley to run the above. Currently this is internal and not exported so here's the code:

p_seeRipley <-
function() {
    URL <- "http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.15/PACKAGES"
    x <- tolower(readLines(URL))
    sapply(strsplit(x[grep("package:", x)], ": "), function(x) x[2])
}

Also it looks like bioconductor uses its own install function now:

source("http://bioconductor.org/biocLite.R")
biocLite("limma")

http://www.bioconductor.org/install/

from pacman.

Dasonk avatar Dasonk commented on May 28, 2024

Just looking through the code... I'm wondering what we need p_exists for?

from pacman.

trinker avatar trinker commented on May 28, 2024

It was to check if something was on CRAN. I thought it may be nice for the user but if we make the changes we were talking about (with having p_load go to the appropriate repository and grab the package) then this seems to not be useful to any great extent.

from pacman.

Dasonk avatar Dasonk commented on May 28, 2024

I guess I just can't see a user saying "is there a package with this name on CRAN?" I personally can't imagine a situation where I would care to use the function as is.

If, though, we put some time into figuring out the github api and were able to search for packages on github and extract user names... that might be useful...

from pacman.

trinker avatar trinker commented on May 28, 2024

Ok here's a scenario. I heard about OpenMx and tried to use install.packages cran. No dice. using p_exists` could be a check but the install.packages error would do that in a way. Not saying its a good idea just presenting why to help make a decision. If it's not useful it adds a function that means more to keep track of and less intuitive; not what pacman is about.

from pacman.

trinker avatar trinker commented on May 28, 2024

The api is sometimes difficult to make exist on a windows machine. Not
saying impossible but difficult for me.

On Sun, Mar 24, 2013 at 12:17 AM, Dason Kurkiewicz <[email protected]

wrote:

I guess I just can't see a user saying "is there a package with this name
on CRAN?" I personally can't imagine a situation where I would care to use
the function as is.

If, though, we put some time into figuring out the github api and were
able to search for packages on github and extract user names... that might
be useful...


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-15351243
.

from pacman.

Dasonk avatar Dasonk commented on May 28, 2024

It's actually not too bad using the api

library(RCurl)
# We can replace the 'ggplot2' with whatever we want to search...
ggplot2Repos <- getURL("https://api.github.com/legacy/repos/search/ggplot2")
# alternatively
ggplot2Repos <- getForm("https://api.github.com/legacy/repos/search/ggplot2") #, language = "R")

# Result is json
library(rjson)

gglist <- fromJSON(ggplot2Repos)
# We only really care about repositories...
gglist <- gglist$repositories
# let's check out the first result...
gglist[[1]] # no surprise that it's Hadley's...

from pacman.

trinker avatar trinker commented on May 28, 2024

Yeah for this task, for creating a repo and sending to github it's been rough. I've abandoned the idea for now:
trinker/reports#5 but for us it seems very usable.

On Sun, Mar 24, 2013 at 1:12 AM, Dason Kurkiewicz
[email protected]:

It's actually not too bad using the api

library(RCurl)

We can replace the 'ggplot2' with whatever we want to search...

ggplot2Repos <- getURL("https://api.github.com/legacy/repos/search/ggplot2")

alternatively

ggplot2Repos <- getForm("https://api.github.com/legacy/repos/search/ggplot2") #, language = "R")

Result is json

library(rjson)

gglist <- fromJSON(ggplot2Repos)

We only really care about repositories...

gglist <- gglist$repositories

let's check out the first result...

gglist[[1]] # no surprise that it's Hadley's...


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-15351644
.

from pacman.

Dasonk avatar Dasonk commented on May 28, 2024

Should we close this issue?

from pacman.

trinker avatar trinker commented on May 28, 2024

I can't remember but I think this came about for the ability to have p_load grab from CRAN or bioconductor. I don't think p_exists needs to do this.

I guess the question we need to answer is do we want to include bioconductor with CRAN in pacman functions as a possible repository?

from pacman.

Dasonk avatar Dasonk commented on May 28, 2024

I think eventually we do but for the time being lets focus on getting things working as best as possible just with CRAN. Adding in Rforge/bioconductor/github comes later.

from pacman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.