Re: [R] predict() works with the design matrix but throws error with some rows of that matrix

2015-11-20 Thread Damir Cosic
Peter, this is extremely helpful. It is my first time using model.matrix() and I was not very clear about it.Thank you for clarifying it! It also helped me figure out how to do out-of-sample prediction. I add it here in case someone else needs help with this. oos.df<-data.frame(x=c(0,1), z=factor

Re: [R] predict() works with the design matrix but throws error with some rows of that matrix

2015-11-20 Thread Damir Cosic
Right on! I was using the expression for binomial logit. Thank you so much! On Fri, Nov 20, 2015 at 12:23 PM, peter dalgaard wrote: > > > On 20 Nov 2015, at 17:17 , Damir Cosic wrote: > > > > > > To do the same with matrix multiplication, I use the expression > 1/(1+exp(-xb)): > > > > head(1/(

Re: [R] exporting tables from an access database using parallel foreach

2015-11-20 Thread Jeff Newmiller
Row numbers are not a standard feature in SQL, and as far as I know the Access Jet engine does not support them. You are supposed to use the key columns to partition your data, but that may require knowing how many records fall within convenient bin sizes if the data are not uniformly distribu

Re: [R] exporting tables from an access database using parallel foreach

2015-11-20 Thread Vivek Sutradhara
Hi John, Thanks a lot for your quick reply. And thanks for drawing my attention to the openslsx package. I will certainly look into it when I work with Excel. But right now, my problems are with Microsoft Access. There are huge tables there which I am not able to export to excel, csv or text files

Re: [R] exporting tables from an access database using parallel foreach

2015-11-20 Thread John McKown
My apologies, you wrote "access" and I read "Excel". I really should not play a game on my smartphone while speed reading emails. On Fri, Nov 20, 2015 at 11:38 AM, Vivek Sutradhara wrote: > Hi > I want to extract data from a Microsoft access database having many tables > with more than 1e7 rows.

Re: [R] exporting tables from an access database using parallel foreach

2015-11-20 Thread John McKown
A possibility could be to not use ODBC, but the CRAN package openslsx ( https://cran.revolutionanalytics.com/web/packages/openxlsx/index.html ). Then use the read.xlsx() function. Description Read data from an Excel file or Workbook object into a data.frame Usage read.xlsx(xlsxFile, sheet = 1, st

[R] exporting tables from an access database using parallel foreach

2015-11-20 Thread Vivek Sutradhara
Hi I want to extract data from a Microsoft access database having many tables with more than 1e7 rows. I find that the following code works to export a table to a rds file : # setwd('C:/sFolder') library(RODBC);library(DBI) ch<-odbcConnect("sample") #No. of rows in the table no

[R] [R-pkgs] matlib package for linear algebra and multivariate statistics

2015-11-20 Thread Michael Friendly
Dear useRs A new package, "matlib" has been under development and the latest version, 0.5.2, will shortly be on CRAN. http://cran.us.r-project.org/web/packages/matlib/ The package is designed to provide a collection of functions and vignettes for teaching and learning linear algebra and multiv

Re: [R] predict() works with the design matrix but throws error with some rows of that matrix

2015-11-20 Thread peter dalgaard
> On 20 Nov 2015, at 17:17 , Damir Cosic wrote: > > > To do the same with matrix multiplication, I use the expression > 1/(1+exp(-xb)): > > head(1/(1+exp(-(cbind(c(1), mm) %*% coef(m)[2,] > > which should produce the third column above, but it doesn't: > I'm rusty on this, but I suspec

Re: [R] knn - random result although use.all=TRUE

2015-11-20 Thread David L Carlson
Changing your definition of cl to clase let me replicate the problem. If you set a random seed just before running knn() the results are consistent so that indicates that the function is drawing a random number at some point. You should probably contact the package maintainer, but your toy data

[R] certificate error when downloading from cran.r-project.org

2015-11-20 Thread pim schravendijk
Excuse me if this may be a superfluous question, but I was wondering if maybe a change in the r-project server configuration broke the certificate. Or are the certificates in my browser outdated? Anyway, when downloading R source code from cran I get the following error: ERROR: certificate common

[R] [R-pkgs] Version 0.3.2 of bnclassify on CRAN

2015-11-20 Thread Bojan Mihaljevic
Dear R users, I am glad to announce that version 0.3.2 of bnclassify is on CRAN. bnclassify implements algorithms for learning the structure and parameters of discrete Bayesian network classifiers from data, fast prediction with complete data, cross-validation and utility functions for inspecting

Re: [R] predict() works with the design matrix but throws error with some rows of that matrix

2015-11-20 Thread peter dalgaard
On 20 Nov 2015, at 10:07 , peter dalgaard wrote: >> >> On 20 Nov 2015, at 04:53 , Damir Cosic wrote: >> >> Hello, >> >> I am having problems with predict() after a multinomial logit regression by >> multinom(). I generate a design matrix with model.matrix() and use it to >> estimate the mode

Re: [R] predict() works with the design matrix but throws error with some rows of that matrix

2015-11-20 Thread peter dalgaard
> On 20 Nov 2015, at 04:53 , Damir Cosic wrote: > > Hello, > > I am having problems with predict() after a multinomial logit regression by > multinom(). I generate a design matrix with model.matrix() and use it to > estimate the model. Then, if I pass the entire design matrix to predict(), > it