[R] FW: Predictive accuracy measures in a recently released R package, spm: Spatial Predictive Modelling [SEC=UNCLASSIFIED]

2017-08-29 Thread Li Jin
Hi All, Just thought you might be interested in a recently released R package, spm: Spatial Predictive Modelling. It aims to introduce some novel, accurate, hybrid geostatistical and machine learning methods for spatial predictive modelling. Of 22 functions available in spm, two functions ar

Re: [R] help with read.csv() for files with different number of columns

2017-08-29 Thread David Winsemius
> On Aug 29, 2017, at 2:59 PM, Jim Lemon wrote: > > Hi Ace, > You can just read the file first to find out: > > max_fields<-function(file,sep=" ") { > rlines<-readLines(file) > return(max(unlist(lapply(sapply(rlines,strsplit,sep),length > } > nmax<-max_fields(test.txt,"\t") > > Jim Or jus

Re: [R] RMarkdown question

2017-08-29 Thread Roy Mendelssohn - NOAA Federal
Thanks. I will try that and see if I can get it to work. I am working on a vignette for a package. I should have been more careful in my wording, it was really a RMarkdown question, not specifically an RNotebook question. I will leave to others to decide if that implies R content, I am jus

Re: [R] help with read.csv() for files with different number of columns

2017-08-29 Thread Jim Lemon
Hi Ace, You can just read the file first to find out: max_fields<-function(file,sep=" ") { rlines<-readLines(file) return(max(unlist(lapply(sapply(rlines,strsplit,sep),length } nmax<-max_fields(test.txt,"\t") Jim On Wed, Aug 30, 2017 at 2:22 AM, Fix Ace wrote: > Thank you very much! Lo

Re: [R] RMarkdown question

2017-08-29 Thread Yihui Xie
Although it is not an elegant solution, but if your output format is HTML, you can add an arbitrary empty HTML element like before your code chunk. Then you can jump to this via a link like "see [this code chunk](#foo)". Regards, Yihui -- https://yihui.name On Tue, Aug 29, 2017 at 1:30 PM, Roy

Re: [R] Print all In new window R 3.4.1 post-installation problems in Mac OSX 10.12.6

2017-08-29 Thread Bert Gunter
I think you should post on R-Sig-Mac, don't you? -- Bert 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 Tue, Aug 29, 2017 at 11:25 AM, Ramnik Bansal wrote: >

Re: [R] RMarkdown question

2017-08-29 Thread Jeff Newmiller
You are sadly confusing R Notebooks with other knitr-based processing formats such as bookdown/LaTeX, as I have in the past. The features available for cross-referencing are strongly tied to the underlying handling of knitr output. This area of "knitr" functionality is a recurring area where ne

Re: [R] help with read.csv() for files with different number of columns

2017-08-29 Thread Fix Ace via R-help
Thank you very much! Looks like I have to know the length of each record ahead of time. Ace On Monday, August 28, 2017 12:56 AM, Jim Lemon wrote: Hi Ace, With tabs as separators: testdf<-read.table("test.txt",header=FALSE,fill=TRUE,sep="\t", col.names=paste("V",1:19,sep=""),stringsAsF

[R] RMarkdown question

2017-08-29 Thread Roy Mendelssohn - NOAA Federal
Hi All: In creating a R Notebook I know that in the text I can link to a (sub) section by using the command: [Header 1](#anchor) and putting the appropriate anchor name at the appropriate header. But can the same be done for code chunks, if the code chunk is named? What I want to do is

[R] Print all In new window R 3.4.1 post-installation problems in Mac OSX 10.12.6

2017-08-29 Thread Ramnik Bansal
Hi, I installed R 3.4.1 on Mac OSX 10.12.6 version. On opening Preferences and trying to change the editor font by clicking the select button I get following error message in R. 2017-08-28 11:57:41.551 R[809:11355] *** RController: caught ObjC exception while processing system events. Update to

Re: [R] regex - optional part isn't considered in replacement with gsub

2017-08-29 Thread Stefan Evert
> On 27 Aug 2017, at 18:18, Omar André Gonzáles Díaz > wrote: > > 3.- If I make the 2 first letter optional with: > > ecommerce$sku <- > gsub("(.*)([a-zA-Z]?{2}[0-9]{2}[a-zA-Z]{1,2}[0-9]{2,4})(.*)", "\\2", > ecommerce$producto) > > "49MU6300" is capture, but again only "32S5970" from B (missi

Re: [R] DBI::dbWriteTable syntax error apparently from quotes

2017-08-29 Thread Eric Berger
I did not put the double quotes in the SQL statement. The SQL statement was created automatically by the routine dbWriteTable. The full code (minus the details of creating the DBIConnection object) would be like this, as in the man page for dbWriteTable library(DBI) library(odbc) conn <- [connect

Re: [R] DBI::dbWriteTable syntax error apparently from quotes

2017-08-29 Thread Jeff Newmiller
Double quotes are not legal SQL syntax. Use single quotes. -- Sent from my phone. Please excuse my brevity. On August 29, 2017 2:21:44 AM PDT, Eric Berger wrote: >I have been successfully using RODBC for a long time (years) to connect >to >MS SQL Server from R. >This week I wanted to try using o

Re: [R] Fwd: Find maxima of a function

2017-08-29 Thread Martin Maechler
> Ranjan Maitra > on Sun, 27 Aug 2017 08:17:15 -0500 writes: > I have not followed the history of this thread, but I am > quite flummoxed as to why the OP is rewriting code to > estimate parameters from an univariate Gaussian mixture > model when alternatives such as E

[R] DBI::dbWriteTable syntax error apparently from quotes

2017-08-29 Thread Eric Berger
I have been successfully using RODBC for a long time (years) to connect to MS SQL Server from R. This week I wanted to try using odbc but I am seeing some problems which may be related to how I set up my driver and/or connection. The dbWriteTable manual page gives as an example command: dbWriteTab

[R] cannot compile R with readline

2017-08-29 Thread Martin Ivanov
Hello, I am trying to install R-3.4.1 on a linux cluster.  I always get the following error message: checking readline/history.h usability... yes checking readline/history.h presence... yes checking for readline/history.h... yes checking readline/readline.h usability... yes checking readline/readl

Re: [R] Extracting subset from netCDF file using lat/lon and converting into .csv in R

2017-08-29 Thread Michael Sumner
On Tue, 29 Aug 2017 at 07:22 Eeusha Nafi wrote: > I have a series of nertCDF files containing global data for a particular > variable, e.g. tmin/tmax/precipiation/windspeed/relative > humuidity/radiation etc. I get the following information when using > *nc_open* function in R: > > datafile: http

Re: [R] Extracting subset from netCDF file using lat/lon and converting into .csv in R

2017-08-29 Thread Eeusha Nafi
Thank you for the kind reply. 1. The order of the dimension is reflected when used as print(ncin) function. This function has been used to have a quick look at the structure of the default netCDF file. 2. Firstly, I am in need of subsetting this netCDF file and then have to convert the slice into .