Re: [R] R: sim1000G

2020-10-31 Thread Abby Spurdle
Hi Berina, I'm not an expert on genetics. I haven't looked at the package. And I've only glanced at your question. So, this is probably not the best response. But as no one else has responded, here's some comments: (1) Have you checked if there's a function in the package to do what you want? T

Re: [R] FREDR and R 3.6

2020-10-31 Thread Richard O'Keefe
I'm running Ubuntu 18.04 LTS and r-base/bionic-cran35,now 3.6.3-1bionic all [installed] 3.6.3 is also the latest version in the repository. On Fri, 30 Oct 2020 at 12:21, Marc Schwartz via R-help wrote: > > > On Oct 29, 2020, at 6:35 PM, H wrote: > > > > On 10/29/2020 01:49 PM, Marc Schwartz wr

Re: [R] [R-sig-Geo] raster::levels() not working in packaged function.

2020-10-31 Thread nevil amos
Many thanks, That worked, since the NAMESPACE file incudes a warning about editing it directly I ysed the reoygen tag in the fucntion script #' @import raster. On Sun, 1 Nov 2020 at 00:18, Marcelino de la Cruz Rot < marcelino.delac...@urjc.es> wrote: > Maybe including > > import(raster) > > or >

Re: [R] fast way to find most common value across columns dataframe

2020-10-31 Thread Rui Barradas
Hello, Here is a comparative test of 3 options. cumstats::Mode returns a list with two members, Values: all the modes. Frequency: their frequency The value of the mode must be extracted after. cumstats::Mode is by far the slowest but returns more information. The function below is in this S

Re: [R] fast way to find most common value across columns dataframe

2020-10-31 Thread Luigi Marongiu
Thank you. The problem was not finding the mode but applying it the R way (I have the tendency to loop into each line of the dataframes, which I believe is NOT the R way). I'll try them. Best regards Luigi On Sat, Oct 31, 2020 at 5:40 PM Bert Gunter wrote: > > As usual, a web search ("find statis

Re: [R] fast way to find most common value across columns dataframe

2020-10-31 Thread Bert Gunter
As usual, a web search ("find statistical mode in R") brought up something that is possibly useful -- Did you try this before posting? If not, please do so in future and let us know what your results were if you subsequently post here. Here's what SO suggested: Mode <- function(x) { ux <- uniq

Re: [R] [R-sig-Geo] raster::levels() not working in packaged function.

2020-10-31 Thread Marcelino de la Cruz Rot
Maybe including import(raster) or importFrom("raster", "levels") in the package NAMESPACE would help. Cheers, Marcelino El 31/10/2020 a las 13:24, nevil amos escribió: Apologies, I cannot see how to make a rero for this issue. I have a function that uses levels(r) tor return the RAT of a

[R] raster::levels() not working in packaged function.

2020-10-31 Thread nevil amos
Apologies, I cannot see how to make a rero for this issue. I have a function that uses levels(r) tor return the RAT of a raster "r" when the function is sourced from a script source(".\R\function.r") it works fine. when the function is built into a package and sourced from there library(mypackage)

Re: [R] fast way to find most common value across columns dataframe

2020-10-31 Thread Jim Lemon
Hi Luigi, If I understand your request: library(prettyR) apply(as.matrix(df),1,Mode) [1] "C" "B" "D" ">1 mode" ">1 mode" ">1 mode" "D" [8] "C" "B" ">1 mode" Jim On Sat, Oct 31, 2020 at 7:56 PM Luigi Marongiu wrote: > Hello, > I have a large dataframe (1 000 000 ro

[R] fast way to find most common value across columns dataframe

2020-10-31 Thread Luigi Marongiu
Hello, I have a large dataframe (1 000 000 rows, 1000 columns) where the columns contain a character. I would like to determine the most common character for each row. In the example below, I can parse one row at the time and find the most common character (apart for ties...). But I think this will