I want to change the specific components of R's two-dimensional array.

Asked 5 months ago, Updated 5 months ago, 10 views

I'd like to make all values that appear more than 10 times from 2D array a random. How should I describe them?I want to do it without looping.
For writing using the for statement,

for(time in unique(a)){

I think I can write like that, but I don't know how to make it happen without using a loop.The work we're doing now involves a large number of two-dimensional arrays, so we're looking for ways to achieve this without looping as much as possible.
If you are familiar with the description of R, please take care of it.


2022-09-30 13:46

1 Answers

The following is how to use the table function:

a [a% in %f [f$Freq>=10,]$a] <-0

You can use the table function to obtain the frequency at which unique elements appear.

2022-09-30 13:46

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.