On 11-03-31 7:24 AM, Alexander Engelhardt wrote:
Hi,
I had a piece of code which looped over a decimal vector like this:
for( i in where ){
thisdata<- subset(herde, herde$mlr>= i)
# do stuff with thisdata..
}
'where' is a vector like seq(-1, 1, by=0.1)
The solution to this problem is
e
that a reasonable answer can be extracted from a given body of data.
~ John Tukey
> -Oorspronkelijk bericht-
> Van: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] Namens Alexander Engelhardt
> Verzonden: donderdag 31 maart 2011 14:57
> Aan: r-hel
n Thu, Mar 31, 2011 at 3:56 PM, Alexander Engelhardt
wrote:
> Am 31.03.2011 14:41, schrieb Sarah Goslee:
>>
>> On Thu, Mar 31, 2011 at 8:14 AM, Alexander Engelhardt
>>>
>>> this helps, thank you.
>>> But if this code is in a function, and some user supplies a vector, I
>>> will
>>> still have to r
Am 31.03.2011 14:41, schrieb Sarah Goslee:
On Thu, Mar 31, 2011 at 8:14 AM, Alexander Engelhardt
this helps, thank you.
But if this code is in a function, and some user supplies a vector, I will
still have to round it in the function, I guess.
It's weird how 0.1 is different from round(0.1, dig
On Thu, Mar 31, 2011 at 8:14 AM, Alexander Engelhardt
> this helps, thank you.
> But if this code is in a function, and some user supplies a vector, I will
> still have to round it in the function, I guess.
>
> It's weird how 0.1 is different from round(0.1, digits=1) , but I don't want
> to read t
A very straightforward way to avoid this problem is to construct the
sequence by multiplying a sequence of integers by an approriate
constant. E.g. for your first example:
for( i in where ){
thisdata<- subset(herde, herde$mlr>= i)
# do stuff with thisdata..
}
'where' is a vecto
On 31-Mar-11 11:24:01, Alexander Engelhardt wrote:
> Hi,
> I had a piece of code which looped over a decimal vector like this:
>
> for( i in where ){
>thisdata <- subset(herde, herde$mlr >= i)
># do stuff with thisdata..
> }
>
> 'where' is a vector like seq(-1, 1, by=0.1)
>
> My problem
Hi,
I had a piece of code which looped over a decimal vector like this:
for( i in where ){
thisdata <- subset(herde, herde$mlr >= i)
# do stuff with thisdata..
}
'where' is a vector like seq(-1, 1, by=0.1)
My problem was: 'nrow(thisdata)' in loop repetition 0.4 was different if
'where' wa
8 matches
Mail list logo