Glad you had a positive experience with the documentation... there are many
gems to be found there.
But I don't think rm.na will work... the na comes before the rm for some reason.
On June 3, 2020 11:13:28 PM PDT, Ogbos Okike wrote:
>Dear Jeff,
>It worked!!! I took a second look at "?mean" as y
Dear Jeff,
It worked!!! I took a second look at "?mean" as you suggested.
I then adjusted my code, inserting rm.na here and there until it was fine.
Thank you very much.
Warm regards.
Ogbos
On Thu, Jun 4, 2020 at 3:14 AM Jeff Newmiller
wrote:
> Perhaps read ?mean...
>
> On June 3, 2020 6:15:11 PM
Perhaps read ?mean...
On June 3, 2020 6:15:11 PM PDT, Ogbos Okike wrote:
>Dear Jeff,
>Thank you so much for your time.
>I tried your code. It successfully assigned NA to the zeros.
>
>But the main code seems not to work with the NAs. The mean, for
>example,
>resulted in NA. I am attaching the dat
df[[ 5 ]][ 0 == df[[ 5 ]] ] <- NA
On June 3, 2020 1:59:06 AM PDT, Ogbos Okike wrote:
>Dear R-Experts,
>I have a cosmic ray data that span several years. The data frame is of
>the
>form:
>03 01 01 003809
>03 01 01 013771
>03 01 01 023743
>03 01 01 033747
>03 01 01 043737
>03 01
Hello,
I forgot about %in%. Maybe because in the OP there were regex's.
And rowSums is much faster than apply.
In my tests this is 7 times faster than mine but with
%in% instead of grepl and apply(no, 1, any)
Hope this helps,
Rui Barradas
Às 18:34 de 03/06/20, Bert Gunter escreveu:
regex's
Hi Rui,
thank you so much, that is exactly what I needed!
Cheers,
Ana
On Wed, Jun 3, 2020 at 11:50 AM Rui Barradas wrote:
>
> Hello,
>
> If you want to filter out rows with any of the values in a 'unwanted'
> vector, try the following.
>
> First, create a test data set.
>
> x <- scan(what = cha
regex's are not needed. Using Rui's example:
> bad <- mapply(function(x) x %in% unwanted,dat)
> dat[!rowSums(bad),]
V1 V2 V3 V4 V5
2 E117 E113 E119 E100 E10
4 E114 E11 E119 E119 E114
5 E109 E111 E103 E103 E100
7 E108 E113 E119 E117 E11
8 E114 E105 E10 E109 E110
9 E119 E116
#Below returns long list of TRUE/FALSE values,
#Note: "IDs" is a column name,
#Wrap with head() to shorten:
df$IDs %in% c("ident_1", "ident_2");
#Below returns index of IDs that are TRUE,
#Wrap with head() to shorten:
which(df$IDs %in% c("ident_1", "ident_2"));
#Below returns short TRUE/FALSE tab
Hello,
If you want to filter out rows with any of the values in a 'unwanted'
vector, try the following.
First, create a test data set.
x <- scan(what = character(), text = '
"E10" "E103" "E104" "E109" "E101" "E108" "E105" "E100" "E106" "E102"
"E107" "E11" "E119" "E113" "E115" "E111" "E114"
Dear R-Experts,
I have a cosmic ray data that span several years. The data frame is of the
form:
03 01 01 003809
03 01 01 013771
03 01 01 023743
03 01 01 033747
03 01 01 043737
03 01 01 053751
03 01 01 063733
03 01 01 073732.
where the columns 1 to 5 stand for year,
I suggest that you forget all that fancy stuff (and this is not a use case
for regular expressions).
Use %in% with logical subscripting instead -- basic R functionality that
can be found in any good R tutorial.
> x <- c("ab","bc","cd")
> x[x %in% c("ab","cd")]
[1] "ab" "cd"
> x[!x %in% c("ab","c
Hi Bert
The issue is that I have around 2000 columns so I can not be checking if
those two are not present in each column of any row “by hand” so to
speakAnd I need my output to be a data frame where neither E102 nor
E112 are present. Basically from the data frame columns that I already
create
Hi John,
This is a bit off-topic for this mailing list as your issue is a
linux, specifically Fedora, issue, and not R.
I don't use Fedora but I did a quick Google search on
fedora missing package .pc file
and that came back with a lot of hits. This one in particular should
be a good place to
On Fri, 29 May 2020 08:47:35 +0300
Eric Berger wrote:
> Hi John,
> This is a bit off-topic for this mailing list as your issue is a
> linux, specifically Fedora, issue, and not R.
> I don't use Fedora but I did a quick Google search on
>
> fedora missing package .pc file
>
> and that came ba
Ok, thank you for the advice I will take some time to see in details
these packages.
Le 19/05/2020 à 05:44, Jeff Newmiller a écrit :
Laurent... Bill is suggesting building your own indexed database... but this
has been done before, so re-inventing the wheel seems inefficient and risky. It
Laurent... Bill is suggesting building your own indexed database... but this
has been done before, so re-inventing the wheel seems inefficient and risky. It
is actually impossible to create such a beast without reading the entire file
into memory at least temporarily anyway, so you are better
Hello.
I am trying to filter only rows that have ANY of these variables:
E109, E119, E149
so I did:
controls=t %>% filter_all(any_vars(. %in% c("E109", "E119","E149")))
than I checked what I got:
> s0 <- sapply(controls, function(x) grep('^E10', x, value = TRUE))
> d0=unlist(s0)
> d10=unique(d0)
17 matches
Mail list logo