Displaying 8 results from an estimated 8 matches for "somevector".
Did you mean:
somefactor
2008 Feb 13
4
rolling sum (like in Rmetrics package)
...w to R and would like to know how to create a vector of "rolling
sums". (I have seen the Rmetrics package and the rollMean function and I
would like to do the same thing except Sum instead of Mean.) I imagine
someone has done this, I just can't find it anywhere.
Example:
x <- somevector #where x is 'n' entries long
#what I would like to do is:
x1 <- x[1:20]
output1 <- sum(x1)
x2 <- x[2:21]
output2 <- sum(x2)
x3 <- ...
ouput <- c(output1, output2, ...)
Thanks,
JV
--
View this message in context: http://www.nabble.com/rolling-sum-%28like-in-Rmetri...
2018 Jul 03
0
Inconsistencies when extracting with non-integer numeric indices near zero
...ror in c(1, 2)[[as.integer(0.5)]] : attempt to select less than one element in integerOneIndex # Also as expected
c(1,2)[[.5]] --> [1] 1 # Not so expected
c(1,2)[[1.5]] --> [1] 1 # As expected, but this also means somevector[[n]] and somevector[[n+1]] give back the same element for 0<n<1
c(1,2)[[as.integer(-1.5)]] --> [1] 2 # As would be expected, though negative subscript for [[ is of course sketchy
c(1,2)[[-1.5]] --> [1] 1 # But coerced to -2 is the...
2024 Mar 14
1
Spurious warning in as.data.frame.factor()
...(or here, as you prefer)
> }
This might be educational for other people wanting to add a regression
test to their patch. I see that tests/reg-tests-1e.R is already running
under options(warn = 2), so if I add the following near line 750
("Deprecation of *direct* calls to as.data.frame.<someVector>")...
# Should not warn for a call from a derivedDefaultMethod to the raw
# S3 method -- implementation detail of S4 dispatch
setGeneric('as.data.frame')
as.data.frame(factor(1))
...then as.data.frame will remain an S4 generic. Should the test then
rm(as.data.frame) and keep going...
2024 Mar 15
2
Spurious warning in as.data.frame.factor()
...> This might be educational for other people wanting to add a regression
> test to their patch. I see that tests/reg-tests-1e.R is already running
> under options(warn = 2), so if I add the following near line 750
> ("Deprecation of *direct* calls to as.data.frame.<someVector>")...
> # Should not warn for a call from a derivedDefaultMethod to the raw
> # S3 method -- implementation detail of S4 dispatch
> setGeneric('as.data.frame')
> as.data.frame(factor(1))
> ...then as.data.frame will remain an S4 generic. Should t...
2024 Mar 15
1
Spurious warning in as.data.frame.factor()
...might be educational for other people wanting to add a regression
>> test to their patch. I see that tests/reg-tests-1e.R is already running
>> under options(warn = 2), so if I add the following near line 750
>> ("Deprecation of *direct* calls to as.data.frame.<someVector>")...
>> # Should not warn for a call from a derivedDefaultMethod to the raw
>> # S3 method -- implementation detail of S4 dispatch
>> setGeneric('as.data.frame')
>> as.data.frame(factor(1))
>> ...then as.data.frame will remain an...
2002 Apr 27
2
Explanation of Error Diagnostics
Hi,
Is there any documentation to explain R's error diagnostics, e.g. messages
like
>source("../src/sources/routine.R")
Read 8 records
Read 2 records
Error in "[<-"(*tmp*, !test, value = rep(no, length = length(ans))[!test]) :
incompatible types
The nature of the problem incompatible types, is clear; but I'm more
interested in its location, and feel
2024 Mar 14
1
Spurious warning in as.data.frame.factor()
> ? Tue, 12 Mar 2024 12:33:17 -0700
> Herv? Pag?s <hpages.on.github at gmail.com> ?????:
> > The acrobatics that as.data.frame.factor() is going thru in order to
> > recognize a direct call don't play nice if as.data.frame() is an S4
> > generic:
> > ??? df <- as.data.frame(factor(11:12))
> >
> > ???
2009 Nov 17
2
SVM Param Tuning with using SNOW package
Hello,
Is the first time I am using SNOW package and I am trying to tune the cost
parameter for a linear SVM, where the cost (variable cost1) takes 10 values
between 0.5 and 30.
I have a large dataset and a pc which is not very powerful, so I need to
tune the parameters using both CPUs of the pc.
Somehow I cannot manage to do it. It seems that both CPUs are fitting the
model for the same values