Git Product home page Git Product logo

Comments (6)

marchtaylor avatar marchtaylor commented on August 19, 2024

possibly related: window() and trim() do not affect the FLBbiol slots @mat, @fec, and @rec .

from flcore.

marchtaylor avatar marchtaylor commented on August 19, 2024

I think I have found a solution:

library(FLCore)
data(ple4.biol)

# these work
tmp <- replace(ple4.biol@mat$mat, ple4.biol@mat$mat==0, 0.1)
mat(ple4.biol) <- tmp

mat(ple4.biol)[mat(ple4.biol)==0.1] <- 0.2

mat(ple4.biol) <- replace(mat(ple4.biol), mat(ple4.biol)==0.2, 0.3)

from flcore.

iagomosqueira avatar iagomosqueira commented on August 19, 2024

These methods need redoing for classes like FLBiol, containing predictModel. Do tell us about other methods failing. Will do soon and get back to you.

from flcore.

iagomosqueira avatar iagomosqueira commented on August 19, 2024

Hi. Long delay, but after fixing initially window and trim I got to look at this.

First, you should not use @ and $ unless you can check you are passing to the object a value of the exact class required. To modify an FLQuant inside the mat slot of your FLBiol you can use three calls:

mat(ple4.biol) <- FLQuants(mat=tmp)
mat(ple4.biol) <- tmp
mat(ple4.biol, 'mat') <- tmp

First you can pass an FLQuants with tmp given the default name that matches the formula in @model. You can directly pass the new FLQuant, and it will be plcaed by default under the mat name in the FLQuants object. Or you could specify the element isnide the FLQuants object in the assigment operation.

The first two options have always been there, the third one I have just added, so it will be only available in gihutb until 2.6.5 is released next week.

Note that you cannot do

mat(ple4.biol)$mat <- tmp

as the $ subsetting is applied on the result of mat(ple4biol) which is already and FLQuant.

Do these options cover your needs?

Then, for accessing the contents of mat, we now have

# Returns the calculation
mat(ple4.biol)

# Returns the predictModel object
mat(ple4.biol, compute=FALSE)

# Same as above
mat(ple4.biol, FALSE)

# Returns the "mat" FLQuant inside the predictModel FLQuants
mat(ple4.biol, name="mat")

Again, please do let me know if this is eniught or we need to find better ways of using these slots

@dorleta @ssanchezAZTI

from flcore.

iagomosqueira avatar iagomosqueira commented on August 19, 2024

Changes are available in the latest commit in master, 40273f4

from flcore.

marchtaylor avatar marchtaylor commented on August 19, 2024

Dear Iago - Thanks for this. This all works and makes sense to me now. Cheers, M

from flcore.

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.