Just for the hell of is I looked at the huge amount of data to see the
lengths:
> nrow(A)
[1] 8760
> nrow(B)
[1] 734
> sum(is.na(A[, 2]))
[1] 8760
> sum(is.na(B[, 2]))
[1] 0
So it seems your first huge matrix has 8,760 rows where the second entry is
always NA.
B seems to have
On 01/09/2021 6:29 p.m., Rolf Turner wrote:
On Wed, 1 Sep 2021 05:35:03 -0400
Duncan Murdoch wrote:
On 31/08/2021 11:59 p.m., Rolf Turner wrote:
I'm trying to build a pair of (S3) methods, a "formula" method and a
"default" method. The methods have a "data" argument. If the
variables in
Is this the kind of thing you are looking for? It separates the scoping
issue from the method dispatch by defining another S3-generic function,
".foo".
> foo <- function(x, ..., data=NULL) with(data, .foo(x, ...))
> .foo <- function(x, ...) UseMethod(".foo")
> .foo.default <- function(x, ...)
> z <- tibble(Code=c("NA","NZ",NA), Name=c("Namibia","New Zealand","?"))
> z
# A tibble: 3 x 2
Code Name
1 NANamibia
2 NZNew Zealand
3 ?
> subset(z, Code=="NA")
# A tibble: 1 x 2
Code Name
1 NANamibia
> subset(z, is.na(Code))
# A tibble: 1 x 2
Code Name
1 ?
>
Hi,
how can I look for the ISO code for Namibia 'NA' in a list of ISO codes
which looks something like
# A tibble: 10 × 1
location_code
1 NC
[...]
10 NZ
but should look like
# A tibble: 10 × 1
location_code
On Wed, 1 Sep 2021 05:35:03 -0400
Duncan Murdoch wrote:
> On 31/08/2021 11:59 p.m., Rolf Turner wrote:
> >
> > I'm trying to build a pair of (S3) methods, a "formula" method and a
> > "default" method. The methods have a "data" argument. If the
> > variables in question cannot be found in
Why would you ask your question without mentioning that the two vectors may
be of unequal length when your abbreviated example was not like that!
You have two CASES here. In one A is longer and in one B is longer. When
they are the same, it does not matter.
So in your scenario, consider
I thank you all. But the code doesn't work on my different dataset where A and
B have different column lengths. For example,
> dput(A)
structure(c(17897, 17897, 17897, 17897, 17897, 17897, 17897,
17897, 17897, 17897, 17897, 17897, 17897, 17897, 17897, 17897,
17897, 17897, 17897, 17897, 17897,
C1 <- A
C1[,2][which(B[,1]%in%A[,1])] <- B[,2][which(B[,1]%in%A[,1])]
Regards.
Tanvir Ahamed
On Wednesday, 1 September 2021, 11:00:16 pm GMT+2, Eliza Botto
wrote:
deaR useRs,
I have the matrix "A" and matrix "B" and I want the matrix "C". Is there a way
of doing it?
Seems trivial enough Elizabeth, either using a matrix or data.frame.
R is vectorized mostly so A[,1] notation selects a column all at once. Your
condition is thus:
A[,1] == B[,1]
After using your sample data to initialize an A and a B, I get this:
> A[,1] == B[,1]
[1] FALSE FALSE FALSE TRUE
> A
[,1] [,2]
[1,] 12 NA
[2,] 12 NA
[3,] 12 NA
[4,] 13 NA
[5,] 13 NA
[6,] 13 NA
[7,] 14 NA
[8,] 14 NA
[9,] 14 NA
> B
[,1] [,2]
[1,] 116
[2,] 117
[3,] 118
[4,] 139
[5,] 13 10
[6,] 13 11
[7,] 14 12
deaR useRs,
I have the matrix "A" and matrix "B" and I want the matrix "C". Is there a way
of doing it?
> dput(A)
structure(c(12, 12, 12, 13, 13, 13, 14, 14, 14, NA, NA, NA, NA,
NA, NA, NA, NA, NA), .Dim = c(9L, 2L))
> dput(B)
structure(c(11, 11, 11, 13, 13, 13, 14, 14, 14, 6, 7, 8, 9, 10,
Hi,
I found package "npsm" at the links below:
https://mran.microsoft.com/snapshot/2017-02-04/web/packages/npsm/index.html
https://cran.r-project.org/src/contrib/Archive/npsm/
HTH, Bill.
W. Michels, Ph.D.
On Wed, Sep 1, 2021 at 8:27 AM wrote:
>
> I need to install the package "npsm" to
Does this link help?
> https://rdrr.io/cran/npsm/
---JRG
On 9/1/21 10:34 AM, cag...@gmail.com wrote:
> I need to install the package "npsm" to follow Kloke & McKean book. However,
> npsm is no longer on CRAN. So, please let me know in detail how to proceed
> to install it.
>
>
>
>
Instructions can be found at https://github.com/kloke/npsm
On Wed, Sep 1, 2021 at 6:27 PM wrote:
> I need to install the package "npsm" to follow Kloke & McKean book.
> However,
> npsm is no longer on CRAN. So, please let me know in detail how to proceed
> to install it.
>
>
>
> Thanks.
>
>
>
I need to install the package "npsm" to follow Kloke & McKean book. However,
npsm is no longer on CRAN. So, please let me know in detail how to proceed
to install it.
Thanks.
Carlos Gonzalez
[[alternative HTML version deleted]]
__
On Tue, 31 Aug 2021, Jeff Newmiller wrote:
Never use stringsAsFactors on uncleaned data. For one thing you give a
factor to as.Date and it tries to make sense of the integer
representation, not the character representation.
Jeff,
Oops! I had changed it in a previous version of the script and
On Wed, 1 Sep 2021, Richard O'Keefe wrote:
You have missed the point. The issue is not the temporal distance, but the
fact that the data you have are NOT the raw instrumental data and are NOT
subject to the limitations of the recording instruments. The data you get
from the USGS is not the raw
Hi
You can use as.POSIXct function
https://stackoverflow.com/questions/19172632/converting-excel-datetime-seria
l-number-to-r-datetime
But you should preferably try to read the date as character vector and then
convert it to date and time.
Cheers
Petr
> -Original Message-
> From:
On 31/08/2021 11:59 p.m., Rolf Turner wrote:
I'm trying to build a pair of (S3) methods, a "formula" method and a
"default" method. The methods have a "data" argument. If the variables
in question cannot be found in "data" then they should be sought in
the global environment.
My problem is
Hi all,
I'm not sure where to post the suggestions for stats R package, so I've
decided to use the contact email from the package description.
There are several R packages that use "forecast()" method for purposes of
prediction (it is a bit different than "predict()"). The generic was
initially
21 matches
Mail list logo