Hi Ted,

The equivalent of new is a Julia constructor: 
http://julia.readthedocs.org/en/latest/manual/constructors/

For graphs from Graphs.jl, there are a lot of different constructor functions 
depending on the type of graph.

Unfortunately, I don’t know enough about what Gobject means in R to be able to 
help translate your specific example.

 — John

On Feb 23, 2014, at 12:11 AM, Ted Fujimoto <[email protected]> wrote:

> Hi,
> 
> Is there a Julia equivalent of the R function "new"? The documentation of the 
> function is here: 
> http://stat.ethz.ch/R-manual/R-devel/library/methods/html/new.html
> 
> (I'm somewhat new to programming so bear with me). I'm guessing this function 
> is similar to the reserved keyword in Java known as "new", which creates a 
> new instance of a class or array. Say, for example, I want to create a new 
> graph from Graphs.jl. How would I proceed? For a more concrete example, I'm 
> trying to translate the R code below: 
> 
> nnms <- as.character(seq_p)
>   Gobject <-
>     if (sum(G) == 0) {
>       new("graphNEL", nodes = nnms)
>     } else {
>       colnames(G) <- rownames(G) <- nnms
>       as(G,"graphNEL")
>     }

Reply via email to