[R] Loop from List in Geospatial Modeling Environment

2012-08-23 Thread crudeen
Does anyone know how to loop in GME using a list of text values. I am trying to create home ranges for each animal in a point shapefile of locations. Here is an example of the Command Text I am trying to use: l-'SGF4037', 'SGF4244'; for (i in ls()){ kde(in=paste(SGF.shp),

Re: [R] loop in list

2012-07-01 Thread Rui Barradas
Hello, Sorry, forgot to Cc the list. Em 01-07-2012 01:24, R. Michael Weylandt michael.weyla...@gmail.com escreveu: I might think replicate() is slightly more idiomatic, but I'm not in a position to check if simplify=FALSE will keep a list. It does: class(replicate(20, f(1))) # matrix

[R] loop in list

2012-06-30 Thread solafah bh
Hello I have a loop to sample 20 samples and I want to put them in one list, how I can make this??   Regards Sulafah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] loop in list

2012-06-30 Thread Greg Snow
Instead of a loop you can use the replicate or lapply functions which will create lists for you. otherwise you can start with an empty list (mylist - list() ) then add to the list in each iteration of the loop: for(i in 1:10) { mylist[[i]] - myfunction(i) } On Sat, Jun 30, 2012 at 1:34

Re: [R] loop in list

2012-06-30 Thread arun
. - Original Message - From: solafah bh solafa...@yahoo.com To: R help mailing list r-help@r-project.org Cc: Sent: Saturday, June 30, 2012 3:34 PM Subject: [R] loop in list Hello I have a loop to sample 20 samples and I want to put them in one list, how I can make this??   Regards

Re: [R] loop in list

2012-06-30 Thread Rui Barradas
Hello, You can avoid the loop using lapply. f - function(x) sample(100, 10) samp.list - lapply(1:20, f) will choose 20 samples of 10 integers up to 100 and put them in a list. All you need is to write a function f(). f() must have an argument, even if it doesn't use it. If you need other

Re: [R] loop in list

2012-06-30 Thread R. Michael Weylandt michael.weyla...@gmail.com
I might think replicate() is slightly more idiomatic, but I'm not in a position to check if simplify=FALSE will keep a list. Best, Michael On Jun 30, 2012, at 7:13 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You can avoid the loop using lapply. f - function(x) sample(100, 10)

Re: [R] loop on list levels and names

2010-01-22 Thread Ivan Calandra
I didn't know about crantastic actually. I've looked what it is exactly and it indeed looks interesting, but I don't really see how I would know that it would help me for the task. There's a description of what it was built for, but how can I then know which function from this package can help

Re: [R] loop on list levels and names

2010-01-22 Thread Don MacQueen
Without reading all the details of your question, it looks like maybe split() is what you want. split( dataset, paste(dataset$SPECSHOR,dataset$BONE) ) or split( dataset[,3], paste(dataset$SPECSHOR,dataset$BONE) ) -Don At 5:12 PM +0100 1/21/10, Ivan Calandra wrote: Hi everybody! To use

Re: [R] loop on list levels and names

2010-01-22 Thread Matthew Dowle
Great. If you mean the crantastic r package, sorry I wasn't clear, I meant the crantastic website http://crantastic.org/. If you meant the description of plyr then if the description looks useful then click the link taking you to the package documentation and read it. Same for any of the

Re: [R] loop on list levels and names

2010-01-22 Thread Ivan Calandra
Thanks for your advice, I will work on it then! Just one last question. In which package can I find the function data.table? Ivan Le 1/22/2010 17:18, Matthew Dowle a écrit : Great. If you mean the crantastic r package, sorry I wasn't clear, I meant the crantastic website

Re: [R] loop on list levels and names

2010-01-22 Thread Matthew Dowle
data.table is the package name too. Make sure you find ?[.data.table which is linked from ?data.table. You could just do a mean of one variable first, and then build it up from there e.g. dataset[, mean(epLsar), by=SPECSHOR,BONE]. To get multiple columns of output, wrap with DT() like this

[R] loop on list levels and names

2010-01-21 Thread Ivan Calandra
Hi everybody! To use some functions, I have to transform my dataset into a list, where each element contains one group, and I have to prepare a list for each variable I have (altogether I have 15 variables, and many entries per factor level) Here is some part of my dataset: SPECSHORBONE

Re: [R] loop on list levels and names

2010-01-21 Thread Matthew Dowle
One way is : dataset = data.table(ssfamed) dataset[, whatever some functions are on Asfc, Smc, epLsar, etc , by=SPECSHOR,BONE] Your SPECSHOR and BONE names will be in your result alongside the results of the whatever ... Or try package plyr which does this sort of thing too. And sqldf may