Hi
I doubt it is intended (to deliberately exclude "difftime" objects).
Can you please supply a full image() example (with 'x' and/or 'y' as
Dates and a 'z') ? So that I can see what ...
image(x, y, z, useRaster=FALSE)
... looks like, so I can see what you want ...
image(x, y, z, useRaster
Well, if I understand your query, wouldn't the following simple approach
suffice -- it assumes that the results for each company are ordered by
year, as your example seems to show:
## test is your example data
## first remove NA's
test2 <- na.omit(test)
## Now just use tapply():
> out <-with(test
Rui, excellent diagnosis and suggestion. It worked but my damn logic is still
not delivering what I want-will spend more time on it tomorrow.
Kind regards
Ahson
> On 13 April 2021 at 17:06 Rui Barradas wrote:
>
>
> Hello,
>
> A close parenthesis is missing in the nd if.
>
>
> for (i in 1
The date you get using as.Date on a POSIXct value depends on the timezone. That
is, as.Date only pays attention to the underlying UTC seconds-since-epoch
value, so it ignores the timezone which can be unexpected for most people.
TL;DR as.Date is not the same as as.POSIXct( trunc( dtm, units="da
(Revealing my ignorance):
Simpler still than the as.POSIXct() idiom is just to use the as.Date
version:
out <- with(out, out [order(Group, id, as.Date(Date)),])
## all else the same...
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into i
It may not be necessary to insert the rows in that order -- R can identify
and use the information from the rows in in most cases without it.
So to combine the results as you described (the code you sent got garbled a
bit btw -- you should proofread more carefully in future), all you would
need to
Hi
The function `check_irregular()` defined within
`graphics::image.default()` checks if the `useRaster` argument for
`graphics::image()` can be true or must be false.
According to this function, the following example vector is irregular:
```
time <- seq(as.Date("2020-1-1"), as.Date("2020-12-31
Jim, thanks for taking the time to look into this. Yes, these if else
statements are so confusing.
I tried your amended scode and it does not work. The error are as follows:
Error: unexpected '}' in " }"
> NUMBER_OF_SHARES[i] = 100 / is.na(CLOSE_SHARE_PRICE[i])
> }
Error: unexpected '}' in " }"
Hello,
Typo, inline.
Às 17:06 de 13/04/21, Rui Barradas escreveu:
Hello,
A close parenthesis is missing in the nd if.
Should be "the 2nd if".
Rui Barradas
for (i in 1:(nrow(PLC_Return)-1)){
if (i == 1){
NUMBER_OF_SHARES[i] = 100/is.na(CLOSE_SHARE_PRICE[i])
} else if(is.na(PLC
Hello,
A close parenthesis is missing in the nd if.
for (i in 1:(nrow(PLC_Return)-1)){
if (i == 1){
NUMBER_OF_SHARES[i] = 100/is.na(CLOSE_SHARE_PRICE[i])
} else if(is.na(PLC_Return[i, 1]) == is.na(PLC_Return[i + 1, 1])){
NUMBER_OF_SHARES[i]=0
} else {
NUMBER_OF_SHARES[i] = 100
Your code was formatted incorrectly. There is always a problem with the
'else' statement after an 'if' since in R there is no semicolon to mark the
end of a line. Here might be a better format for your code. I would
recommend the liberal use of "{}"s when using 'if/else'
i <- 0
for (i in 1:(
Dear All,I have a dataframe with 4 variables and I am trying to calculate how
many shares can be purchased with £100 in the first year when the company was
listed
The data looks like:
COMPANY_NUMBER YEAR_END_DATE CLOSE_SHARE_PRICE NUMBER_OF_SHARES
2270530/09/200
Hi all,
I have the prediction for my test set which are forecasted Value for "4/1/2020"
for each match of "id" and "Group". I would like to add a fourth row to each
group by (Group,id) in my train set and the values for this row should come
from test set :
my train set:
structure(list(D
Hi Richard and Jim
Thanks for your response. Sorry for the confusion. This is lhs package
(small letters), and after loading the package, I used the function
randomLHS.
The problem remained the same. I am trying to fix the length.out=2 for
lmp=c(0.40, 0.43), and length.out = 4 for all other varia
Hello,
I am trying to install a package from github, but my local installation fails
(whereas doing the very same thing on a remote cluster works, and downloading
the tarball by hand works). I assume the issue is mine, but I have no idea how
to solve it. In any case, here is what I am doing a
Hi Shah,
I think what you are struggling toward is this:
prior_lhs <- list(r_mu=c( 0.00299, 0.0032),
r_sd=c( 0.001, 0.002),
lmp=c( 0.40, 0.43),
gr_mu=c( 0.14, 0.16),
gr_s=c( 0.01, 0.020),
alpha1=c( 0.0001, 0.
16 matches
Mail list logo