I think you need to (re)read the posting guide and "An Introduction to R" and 
try posting again. Some food for thought:

a) You refer to "list files", but this is not a standard term. As the PG says, 
you need to supply a self-contained example, which would either include 
internal objects in dput form, or text data in strings read as though from 
files (e.g. use the "text" argument).

b) You may benefit from using indexing by character strings rather than numeric 
index to avoid mixups in sequencing.

c) I think "Crop$" is a typo?

d) The claim that "it stops accepting the assigned values" is more likely to be 
an error on your part than R being arbitrary. I may be going out on a limb 
here, but be sure you understand that modifications to data within functions 
are local, and you have to explicitly return changes if you want them to 
persist after the function returns.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Wageningen-eR <igor.milosavlje...@wur.nl> wrote:

>Hello,
>
>I am a Masters student and I am working on my thesis modelling
>smallholder
>farms using a program in R.  I have modified the original code and I am
>having some issues with lists that I cannot figure out.
>
>Originally, I had list file defining lists such as: Param, Crop1,
>Crop1,
>Soil, etc.  (ex. Param <- list() ).  Their subsets were listed as
>Crop1$CContent for example and there was quite a few of them.  There is
>a
>run file that gets the list file going in the following code:
>
>#--Initialising the lists to store variable values
>tmp <- init_lists()
>Param       <- tmp[[1]]
>Crop1       <- tmp[[2]]
>Fert        <- tmp[[3]]
>Meteo       <- tmp[[4]]
>Soil        <- tmp[[5]]
>RainPattern <- tmp[[6]]
>Crop2       <- tmp[[7]]
>Cropres     <- tmp[[8]]
>rm(tmp)
>
>The problem here is that the lists get confused with each other; that
>is
>elements of Soil appear in Crop2.  In the run file, I changed the order
>of
>the lists (for example Fert <- tmp[[5]] and Crop2 <-tmp[[3]]) and it
>changes
>which ones are confused with what; with some lists not being confused
>at
>all.  I cannot find why this is a problem as the tmps are removed at
>the end
>of the command list shown below and each element is clearly defined as
>a
>part of its given list with (list name)$(Sublist maybe)$(specific
>element
>name)
>
>Either way, I changed the original lists to be more specific, for
>example:
>
>Crop$ <- list(
>CContent <- NA,
>NContent <- NA,
>PContent <- NA,
>KContent <- NA,
>K <- list(
>uptakegivenN,
>uptakegivenP),
>dryMatterContent
>...etc.
>
>The issue then became that it stops at a certain point accepting the
>assigned values and keeps them as null.  That is, the list contains an
>element that states Crop2$minYieldN <- NA but the value becomes NULL
>when it
>is run.   Also, the list, say Param, contains both:
>
>[[1]]
>[1] NA
>
>[[2]]
>[1] NA
>
>[[3]]
>[[3]][[1]]
>[1] NA
>
>[[3]][[2]]
>[1] NA
> 
>and some of the value names (up to a point)
>
>$inertCRTR
>[1] 0.001
>
>$humificationFactor
>[1] 0.25
>
>$fractionStabilisedSOMC
>[1] 0.2
>
>$growthEffectMicroorganisms
>[1] 0.6
>
>Is it perhaps that the list is too long?  Please let me know if
>anything
>comes to mind, it would be great help.
>
>Thank you!
>
>
>Regards,
>
>-Igor Milosavljevic
>Wageningen University and Research Center
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/7-days-confusion-over-lists-tp4635489.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help@r-project.org 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.

______________________________________________
R-help@r-project.org 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 via email to