Comments (6)
possibly related: window() and trim() do not affect the FLBbiol slots @mat, @fec, and @rec .
from flcore.
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.
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.
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
from flcore.
Changes are available in the latest commit in master, 40273f4
from flcore.
Dear Iago - Thanks for this. This all works and makes sense to me now. Cheers, M
from flcore.
Related Issues (20)
- Helpfile for stock-recruitment models is lacking examples for all but BH
- No help file for fmle()
- no helpfile for qapply
- lattice plotting is erroring
- setting defaults for startf and endf HOT 1
- Option to include fitted models (GLM, GAM) into a FLSR-object HOT 3
- as.FLQuant(data.frame) should only alter the dimanmes added in dimnames= HOT 3
- Loosing units in numerical operations HOT 5
- Add R common scientific format for numbers to uomTable
- MAP missing Rd pages and how to build them with roxygen
- FLSAM - redirect for SAM is incorrect HOT 2
- Conversion of data.frame to FLStock does not name first dimension 'age' HOT 2
- Consistency between [email protected] and FLBiol@spwn HOT 7
- Extend FLStock class to include refpts and SRR HOT 2
- cv in invALK to be a vector of cv or sd
- Write roxygen help for growth models
- Generate catch-at-size dataset for ple4
- Length-based FLQuant converted to age-based when creating FLStock HOT 4
- harvest is different between FLCore 2.6.18 and 2.6.19 when importing SS output through ss3om::readFLSss3 HOT 5
- Add bevholtss3 to abpars()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flcore.