Displaying 20 results from an estimated 20000 matches similar to: "iterating through for loop"
2009 Nov 11
1
How to get the names of list elements when iterating over a list?
I need to get the names of the list elements when I iterate over a
list. I'm wondering how to do so?
alist=list(a=c(1,3),b=c(-1,3),c=c(-2,1))
sapply(alist,function(x){
#need to use the name of x for some subsequent process
})
2015 Aug 06
2
Weird issue when iterating through dates
>> Just a quick question: what's the difference between `[.Date` and
`[[.Date`?
>> Is it supposed to be the method for accessing the value right?
>
>For Dates and atomic vectors in general they are the same, but ...
Even for atomic vectors with names they are not quite the same
> c(One=1, Two=2)[[2]]
[1] 2
> c(One=1, Two=2)[2]
Two
2
(and [[ will
2012 Apr 28
6
problem in matching numbers in two variables
i want to compare two variables (having numbers) serially for
matching/dismatching
both having equal length
> x
[1] 2 2 1 2 3 2 2 2 2 3 3 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 3 2 3 2 2 2 1
2 2
[38] 2 2 2 3 2 3 2 2 1 2 2 2 2 1 1 1 3 2 2 2 2 1 1 3 1 1 1 2 2 2 3 2 3 3 3
2 2
[75] 2 2 3 2 2 1 1 1 2 3 2 2 2 2 2 2 2 2 2 1 1 3 2 2 2 2 2 2 2 2 2 2 2 1 3
> y
[1] 2 2 2 1 3 1 3 2 1 3 3 3 3 2 2 1 2 3
2012 May 26
2
avoid error within for loop, try, trycatch, while, move to next iteration, unlist
Hi there,
I would like to ask something about how to avoid a possible error message within a for loop. I am running a simulation and in some repetitions there may be an error that will cause a crash and stop the whole procedure, what I want is to simply move on to the next iteration automatically and discard the "bad" repetitions from my results. I used the "try" function to
2015 Aug 12
2
Weird issue when iterating through dates
I am not sure if this is a bug or not.
Gabor
On Wed, Aug 12, 2015 at 11:51 AM, Luca Cerone <luca.cerone at gmail.com> wrote:
> Following up on this, should I report a bug? can you drive me through
> the process?
>
> Cheers,
> Luca
>
> On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap <wdunlap at tibco.com> wrote:
>>>> Just a quick question: what's
2015 Aug 06
2
Weird issue when iterating through dates
Thanks G?bor,
I thought there was some mistake in my logic on how casting works in R
and wanted to be sure.
Just a quick question: what's the difference between `[.Date` and `[[.Date`?
Is it supposed to be the method for accessing the value right?
Thanks again for your help,
Cheers,
Luca
On Thu, Aug 6, 2015 at 10:10 AM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote:
> Date has a
2005 Apr 18
1
Storing vectors as vectors and iterating through them
Hi all,
I have a bunch of int vectors. Each vector holds a bunch of ints that
correspond to row numbers of an existing matrix. I use the int vectors to
pull out rows of data from a matrix, i.e.
data <- my_matrix[int_vector,]
I would like to store these int vectors in some sort of data structure that
will preserve them as-is and allow iteration. I guess what I'm looking for
would be
2004 Feb 08
5
iterating over files in a directory with R
Hello,
I'm an R newbie and was wondering whether there are R commands for iterating over files in a directory. Basically what I want to do is to iterate over many files and apply some R functions to each file seperately.
e.g. for (each file in a directory) do { some R calculation with the info in that file }
Could someone please give me a pointer to how (or if) this might be done with R
2007 Oct 16
3
Controller iterating through returned records and appending to each
I have a controller that gets a list of employees (which has an "include =>
[:salaries, :incentives, :billablegoals, :reviews]"). I then need it to
iterate through each employee and determine their current active goal based
on the "effective date."
After playing around with it a bunch, I got the following to work. Only
problem is that if I remove the "@employees.each {
2017 Dec 08
2
Curiously short cycles in iterated permutations with the same seed
I have noticed that when I iterate permutations of short vectors with the same seed, the cycle lengths are much shorter than I would expect by chance. For example:
X <- 1:10
Xorig <- X
start <- 112358
N <- 10
for (i in 1:N) {
seed <- start + i
for (j in 1:1000) { # Maximum cycle length to consider
set.seed(seed) # Re-seed RNG to same initial state
X <- sample(X)
2017 Dec 08
0
Curiously short cycles in iterated permutations with the same seed
Hi Boris,
Do a search on "the order of elements of the symmetric group". (This search
will also turn up homework questions and solutions.) You will understand
why you are seeing this once you understand how a permutation is decomposed
into cycles and how the order relates to a partition of n (n=10 in your
case).
Enjoy!
Eric
On Fri, Dec 8, 2017 at 6:39 AM, Boris Steipe <boris.steipe
2006 Apr 10
2
RJS newbie - need help with iterating / existence test
Greetings!
I''m new to Ajax and am trying to get a basic app working as a vehicle for learning it. The app is an extension of the cookbook tutorial. My intent is to be able to add a list of ingredients for a recipe. The page to add ingredients uses Ajax. As ingredients are added to the page they''re displayed in a "green-bar" format like that used in the Depot
2015 Aug 12
0
Weird issue when iterating through dates
On Wed, Aug 12, 2015 at 10:55 AM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote:
> I am not sure if this is a bug or not.
>
I would argue that this isn't a bug, not even in the documentation of
"for" (even though it might be clearer). ?"for" says that `seq` is
"[A]n expression evaluating to a vector (including a list and an
expression) or to a pairlist or
2012 Feb 10
1
which R package is used for browsing web pages through coding
i know RCurl pakage to retrieve web content,it has limited use, i want
interactive package like
(in perl--->Mechanize,
In java--->Watij,Prowser,HTMLunit,HTTPunit,
in Ruby---->Watir ,etc)
this modules/packages opens appropriate browser,which can create
queries,retrieves output, clicks buttons, fill up form
automatically,searches keyword in search engine, Downloads many items from
2012 Feb 08
2
which R package is used for browsing web pages through coding
Perl has Mechanize module which browse web pages through
programming(coding),creates queries & retrives data through it
which R package support web browsing through programming
--
View this message in context: http://r.789695.n4.nabble.com/which-R-package-is-used-for-browsing-web-pages-through-coding-tp4368349p4368349.html
Sent from the R help mailing list archive at Nabble.com.
2012 Feb 28
2
how to append element at last position in array dynamically
> h<-array()
> h
[1] NA
> append(h,9)
[1] NA 9
but what it append.........
> h
[1] NA
--
View this message in context: http://r.789695.n4.nabble.com/how-to-append-element-at-last-position-in-array-dynamically-tp4427893p4427893.html
Sent from the R help mailing list archive at Nabble.com.
2009 Dec 03
1
Iterating over array to create users and files
I want to do the following
declare variable:
$usernames = [ "chris", "bob", "tim" ]
How would I iterate over it to create something like:
user { "$username":
home => "/home/$username",
}
Also is it possible to create a more complex structure with $UID and
$Shell
I''m thinking of something like this:
$users
2012 Feb 05
2
how to avoid writing index in write.table command
how to avoid writing index of variable in write.table command,
e.g. output--->
index,character,state
"1" "M" "2"
"2" "K" "3"
"3" "R" "1"
"4" "E" "1"
"5" "S" "1"
"6" "H" "1"
"7" "K" "1"
2012 Mar 31
2
Is it there any std pattern in R which show same representation style of ppt found on net
i m searching on net,material related to R,
whenever i get ppt presentation of some topic ,i found it in speical format
white backgroud & blue bars,having links for further topics
see link
1) https://www.rmetrics.org/files/Meielisalp2007/Presentations/Pfaff.pdf
2)http://grapevine.com.au/~yanchang/docs/Time-Series-Mining-slides.pdf
If this is format,how can i made it,if i want to give my R
2012 May 26
6
how to check given number seq. is time series or not?
i have following numbers
0.889046409368551
1.22726162946495
1.22726162946495
1.35785109728356
1.35785109728356
1.10704609982913
1.4424189950435
1.2277843378837
1.35785109728356
0.970883941918588
0.822170913920467
1.35785109728356
0.358815782262543
0.774234247460432
0.822170913920467
0.822170913920467
0.72599976881814
0.671583894425946