Re: [R] How to efficiently generate data of points within specified radii for each geometric point

2020-06-01 Thread Jeff Newmiller
Wrong list. Do _read_ the Posting Guide and then check out r-sig-geo. On June 1, 2020 5:18:49 PM PDT, Lom Navanyo wrote: >Hello, >I have data set of about 3400 location points with which I am trying to >generate data of each point and their neighbors within defined radii >(eg, >0.25, 1, and 3 mil

[R] How to efficiently generate data of points within specified radii for each geometric point

2020-06-01 Thread Lom Navanyo
Hello, I have data set of about 3400 location points with which I am trying to generate data of each point and their neighbors within defined radii (eg, 0.25, 1, and 3 miles). Below is a reprex using the built-in nz_height data: library(sf) library(dplyr) library(spData) library(ggplot2) librar

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hi Jim, not in this case, but thanks for asking! Ana On Mon, Jun 1, 2020 at 10:04 PM Jim Lemon wrote: > > So recombination sticks out its foot before us. Do you want to account > for gene linkage? > > JIm > > On Tue, Jun 2, 2020 at 11:55 AM Ana Marija > wrote: > > > > Hi Jim > > > > > neu3<-n

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread David Carlson
It might be easier to diagnose if you can show us what the first ten lines in your original file look like. readLines("gokind.nephropathy.fin", n=10) David L Carlson On Mon, Jun 1, 2020 at 6:36 PM Bert Gunter wrote: > Agreed! > > However, there may still be a problem, as read.table() ordinari

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Jim Lemon
So recombination sticks out its foot before us. Do you want to account for gene linkage? JIm On Tue, Jun 2, 2020 at 11:55 AM Ana Marija wrote: > > Hi Jim > > > neu3<-neu1[!(neu1$Marker %in% Marker3),] > > dim(neu3) > [1] 18579 > > nep3<-nep1[!(nep1$Marker %in% Marker3),] > > dim(nep3) > [1]

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hi Jim > neu3<-neu1[!(neu1$Marker %in% Marker3),] > dim(neu3) [1] 18579 > nep3<-nep1[!(nep1$Marker %in% Marker3),] > dim(nep3) [1] 55629 > ret3<-ret1[!(ret1$Marker %in% Marker3),] > dim(ret3) [1] 34939 If I do: nn1<-merge(neu1,nep1,by=c("Marker","Chr")) nn2<-merge(nn1,ret1,by=c("Ma

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hi David, that is a great point! Yes indeed some are non unique: > dim(neu1) [1] 3742845 9 > length(unique(neu1$Marker)) [1] 3741858 > length(unique(nep1$Marker)) [1] 3745560 > dim(nep1) [1] 3746550 9 > length(unique(ret1$Marker)) [1] 3743494 > dim(ret1) [1] 3743494 9 How would

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Jim Lemon
Hi Ana, If I add another 6 rows to neu1, 2 to nep1 and one to ret1 and modify the "Marker" field so that there is one more match, I get the result I expect. I think that the program logic is correct. I can't say why ret1 has fewer lines. If there aren't too many mismatches, maybe checking the misma

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread David Winsemius
On 6/1/20 5:40 PM, Ana Marija wrote: Hi Jim, thank you so much for getting back to me. I tried your code and this is what I get: dim(neu2) [1] 3740988 9 dim(nep2) [1] 3740988 9 dim(ret2) [1] 3740001 9 I think I would need to have the same number of lines in all 3 data

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Rasmus Liland
Dear Ana and Jim, On 2020-06-01 19:40 -0500, Ana Marija wrote: > > dim(neu2) > [1] 3740988 9 > > dim(nep2) > [1] 3740988 9 > > dim(ret2) > [1] 3740001 9 Jim's code works out of the box directly from the email ... I get: [1] 6 9 [1] 4 9 [1] 4 9 On 2020-06-01 19:40 -0500, Ana M

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hi Jim, thank you so much for getting back to me. I tried your code and this is what I get: > dim(neu2) [1] 3740988 9 > dim(nep2) [1] 3740988 9 > dim(ret2) [1] 3740001 9 I think I would need to have the same number of lines in all 3 data frames. Can you please advise. Cheers A

Re: [R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Jim Lemon
Hi Ana, Not too hard, but your example has all the "marker" fields in common. So using a sample that will show the expected result: neu1<-read.table(text="Chr BP Marker MAF A1 A2 Direction pValue N 1 10012 1:10012:G:T 0.229925 T G + 0.650403 1594 1 10827 1:10827:C:T 0.287014

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Bert Gunter
Agreed! However, there may still be a problem, as read.table() ordinarily would read numeric columns correctly (via type.convert()) without the colClasses specification. So I would suspect that her "numeric" columns contain some non-numeric detritus (perhaps "," or some NA symbol). But of course,

Re: [R] Query on contour plots

2020-06-01 Thread Jim Lemon
Good morning Bruce & Abby, The fruit bats of Sydney have retreated to their camps so I can finally answer your last two queries. Attached is a plot of your data set on a 100 x 100 grid. This is how I did it: bfs<-read.csv("Procen_sample.csv") dim(bfs) names(bfs) library(plotrix) # set the matrix l

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread David Winsemius
On 6/1/20 2:17 PM, Ana Marija wrote: > HI David, > > this is the problem: > > > NEP <- read.table("gokind.nephropathy.fin", > header=T,stringsAsFactors=FALSE) > > sapply(NEP,class) >         Chr          BP      Marker         MAF          A1        A2 > "character" "character" "character" "char

[R] is there is a way to extract lines in between 3 files that are in common based on one column?

2020-06-01 Thread Ana Marija
Hello, I have 3 data frames which have about 3.4 mill lines (but they don't have exactly the same number of lines)...they look like this: > neu1=neu[order(neu$Marker),] > head(neu1) ChrBP Marker MAF A1 A2 Direction pValueN 209565 1 10012 1:10012:G:T 0.

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
HI David, this is the problem: > NEP <- read.table("gokind.nephropathy.fin", header=T,stringsAsFactors=FALSE) > sapply(NEP,class) Chr BP Marker MAF A1 A2 "character" "character" "character" "character" "character" "character" Direction pValue

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread David Winsemius
On 6/1/20 1:37 PM, Ana Marija wrote: Hello, I have a dataframe like this: ChrBP Marker MAF A1 A2 Direction pValueN 1 10 10625 10:10625:A:G 0.416562 G A - 0.558228 1594 2 10 10645 10:10645:A:C 0.215182 C A - 0.880622 1594 ..

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
7th fileld, Direction contains only "+" and "-" On Mon, Jun 1, 2020 at 3:46 PM Bert Gunter wrote: > I count 8 fields in your data and 9 names in your heading ?? > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus

Re: [R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Bert Gunter
I count 8 fields in your data and 9 names in your heading ?? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Jun 1, 2020 at 1:38 PM Ana Marija wrote: >

[R] how to load data frame where numeric will be numeric instead of character

2020-06-01 Thread Ana Marija
Hello, I have a dataframe like this: ChrBP Marker MAF A1 A2 Direction pValueN 1 10 10625 10:10625:A:G 0.416562 G A - 0.558228 1594 2 10 10645 10:10645:A:C 0.215182 C A - 0.880622 1594 ... which I load with: NEU <- read.table("g

Re: [R] a question of etiquette

2020-06-01 Thread Jeff Newmiller
Please move this discussion to R-package-devel. On June 1, 2020 12:43:01 PM PDT, Adelchi Azzalini wrote: > > >> On 1 Jun 2020, at 21:35, Sorkin, John >wrote: >> >> Regardless of whether the people who wrote the Matlab code you used >as a reference, or who wrote the paper that published the ide

Re: [R] a question of etiquette

2020-06-01 Thread Adelchi Azzalini
> On 1 Jun 2020, at 21:35, Sorkin, John wrote: > > Regardless of whether the people who wrote the Matlab code you used as a > reference, or who wrote the paper that published the idea that you included > in your package are cited as co-authors of your package, the coders and > authors shoul

Re: [R] a question of etiquette

2020-06-01 Thread Sorkin, John
Regardless of whether the people who wrote the Matlab code you used as a reference, or who wrote the paper that published the idea that you included in your package are cited as co-authors of your package, the coders and authors should be identified as the people from whom you borrowed the idea

Re: [R] a question of etiquette

2020-06-01 Thread Adelchi Azzalini
> On 1 Jun 2020, at 19:37, Michael Dewey wrote: > > You might get better answers on the list dedicated to package development > r-pkg-devel This is a good suggestion. Thanks, Michael. Some initial search of that list did not lead to any indication, but I will have a second look. Best re

Re: [R] Query on contour plots

2020-06-01 Thread Abby Spurdle
Hi, I'm probably biased. But my package, bivariate, contains a wrapper for KernSmooth::bkde2D, which can produce both 3D surface plots and (pretty) contour plots of bivariate kernel density estimates, conveniently. https://cran.r-project.org/web/packages/bivariate/vignettes/bivariate.pdf (pages

[R] [R-pkgs] collapse package: Advanced and Fast Data Transformation in R

2020-06-01 Thread Sebastian Martin Krantz
Dear R users, with some delay I would like to make you aware of the recent CRAN release of *collapse* (https://CRAN.R-project.org/package=collapse), a large new C/C++ based package for advanced and high-performance general purpose data transformation in R. *collapse* has 2 main objectives: 1. To

Re: [R] a question of etiquette

2020-06-01 Thread Michael Dewey
You might get better answers on the list dedicated to package development r-pkg-devel This may have already been discussed there so a quick look at the archive might also help you. On 01/06/2020 17:34, Adelchi Azzalini wrote: The new version of a package which I maintain will include a new f

[R] a question of etiquette

2020-06-01 Thread Adelchi Azzalini
The new version of a package which I maintain will include a new function which I have ported to R from Matlab. The documentation of this R function indicates the authors of the original Matlab code, reference to their paper, URL of the source code. Question: is this adequate, or should I includ

Re: [R] Creating file from raw content

2020-06-01 Thread jim holtman
You can read it in as 'raw' input <- file('your.xlsx', open = 'rb') # open as binary excel_file <- readBin(input, raw(), 1e8) # make sure you read in all the file close(input) output <- file('your_new.xlsx', 'wb') writeBin(excel_file, output) close(output) === Jim

Re: [R] How to create a warning inside the factorial function for decimal numbers

2020-06-01 Thread peter dalgaard
You might check that n %% 1 == 0. (Factorials do exist for fractional numbers -- check e.g. factorial(6.5). And please don't send HTML because, well, you can see the result below) - pd > On 1 Jun 2020, at 12:49 , Vahid Borji wrote: > > I am writing a code for the factorial function. My code i

[R] How to create a warning inside the factorial function for decimal numbers

2020-06-01 Thread Vahid Borji
I am writing a code for the factorial function. My code is as follows: > f<- function(n){+ factorial <- 1+ if( n < 0 )+ print("Factorial of negative > numbers is not possible")+ else if( n == 0 )+ print("Factorial of 0 is 1")+ > else {+ for(i in 1:n)+ factorial <- factorial * i+ print(paste("Fac