Re: [R] Accelerating binRead

2016-09-18 Thread Michael Sumner
Thanks Henrik, that's it. Fwiw I found this old post too, I am still surprised this doesn't seem to get used a lot(?). It's a "neat trick" for row-wise binary, without compiled code. http://cyclemumner.blogspot.com.au/2010/06/read-las-data-with-r.html?m=1 Also you should look at Paul Murrell's he

Re: [R] How are interaction terms computed in lm's result / problems with interaction terms in lm?

2016-09-18 Thread David Winsemius
> On Sep 18, 2016, at 12:39 PM, mviljamaa wrote: > >> On Sep 18, 2016, at 11:01 AM, mviljamaa wrote: >> Also if you, rather than doing what's done below, do: >> fit3 <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs >> + kidmomhsage$mom_age * kidmomhsage$mom_hs) >> Then th

Re: [R] How are interaction terms computed in lm's result / problems with interaction terms in lm?

2016-09-18 Thread mviljamaa
On Sep 18, 2016, at 11:01 AM, mviljamaa wrote: Also if you, rather than doing what's done below, do: fit3 <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs + kidmomhsage$mom_age * kidmomhsage$mom_hs) Then this gives the result: Call: lm(formula = kidmomhsage$kid_score ~

Re: [R] ggplot2 lost label

2016-09-18 Thread David Winsemius
> On Sep 18, 2016, at 11:05 AM, Troels Ring wrote: > > dear friends - I have a problem in ggplot2 which I hope you can help me > understand and solve. > > Running windows 7, R 3.2.1 > > grp <- gl(3,4,12) > trt <- gl(4,1,12) > num <- c(11,1,0,0,6,2,0,0,1,9,10,10) > MM <- data.frame(grp=grp,num

Re: [R] How are interaction terms computed in lm's result / problems with interaction terms in lm?

2016-09-18 Thread David Winsemius
> On Sep 18, 2016, at 11:01 AM, mviljamaa wrote: > > Also if you, rather than doing what's done below, do: > > fit3 <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs + > kidmomhsage$mom_age * kidmomhsage$mom_hs) > > Then this gives the result: > > Call: > lm(formula = ki

[R] ggplot2 lost label

2016-09-18 Thread Troels Ring
dear friends - I have a problem in ggplot2 which I hope you can help me understand and solve. Running windows 7, R 3.2.1 grp <- gl(3,4,12) trt <- gl(4,1,12) num <- c(11,1,0,0,6,2,0,0,1,9,10,10) MM <- data.frame(grp=grp,num=num,trt=trt) levels(MM$grp)<- c("anest1","anest2","anest3") levels(MM$tr

Re: [R] How are interaction terms computed in lm's result / problems with interaction terms in lm?

2016-09-18 Thread mviljamaa
Also if you, rather than doing what's done below, do: fit3 <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs + kidmomhsage$mom_age * kidmomhsage$mom_hs) Then this gives the result: Call: lm(formula = kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs +

[R] How are interaction terms computed in lm's result / problems with interaction terms in lm?

2016-09-18 Thread mviljamaa
I'm trying to use interaction terms in lm and for the following types of models: fit3_hs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs + kidmomhsage$mom_age * 1) fit3_nohs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age + kidmomhsage$mom_hs + kidmomhsage$mom_age * 0)

Re: [R] What are the red line and cut line in lm's Residuals vs Fitted plot?

2016-09-18 Thread David Winsemius
> On Sep 18, 2016, at 7:25 AM, mviljamaa wrote: > > What are the red line and cut line in lm's Residuals vs Fitted plot? > > As seen in e.g.: > > http://i.imgur.com/QvZ6oeT.png R has a `plot.lm` function that is invoked by `plot(lm_object)` when `lm_object` has a class of "lm". It produces m

Re: [R] Accelerating binRead

2016-09-18 Thread Henrik Bengtsson
I second Mike's proposal - it works, e.g. https://github.com/HenrikBengtsson/affxparser/blob/5bf1a9162904c56d59c4735a8d7eb427e4f085e4/R/readCcg.R#L535-L583 Here's an outline. Say each row consists of tuple (=4-byte integer, =4-byte float, ss=2 byte integer) so that the byte-by-byte content

Re: [R] How to plot the regression line of multivariable linear model?

2016-09-18 Thread Ismail SEZEN
> Specifically my model has one response and two predictors, i.e. it's of the > form > > Y = b_0+b_1*X_1+b_2*X_2 > > Plotting the regression line for a single predictor model > > Y = b_0+b_1*X_1 > > is simple enough, just call abline() with the coefficients returned by lm(). Single variable

[R] How to plot the regression line of multivariable linear model?

2016-09-18 Thread mviljamaa
I'm having a bit of trouble plotting the regression line of multivariable linear model. Specifically my model has one response and two predictors, i.e. it's of the form Y = b_0+b_1*X_1+b_2*X_2 Plotting the regression line for a single predictor model Y = b_0+b_1*X_1 is simple enough, just

Re: [R] Accelerating binRead

2016-09-18 Thread Philippe de Rochambeau
I would gladly examine your example, Mike. Cheers, Philippe > Le 18 sept. 2016 à 16:05, Michael Sumner a écrit : > > > >> On Sun, 18 Sep 2016, 19:04 Philippe de Rochambeau wrote: >> Please find below code that attempts to read ints, longs and floats from a >> binary file (which is a simplifi

[R] What are the red line and cut line in lm's Residuals vs Fitted plot?

2016-09-18 Thread mviljamaa
What are the red line and cut line in lm's Residuals vs Fitted plot? As seen in e.g.: http://i.imgur.com/QvZ6oeT.png __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

Re: [R] Accelerating binRead

2016-09-18 Thread Michael Sumner
On Sun, 18 Sep 2016, 19:04 Philippe de Rochambeau wrote: > Please find below code that attempts to read ints, longs and floats from a > binary file (which is a simplification of my original program). > Please disregard the R inefficiencies, such as using rbind, for now. > I’ve also included Java

Re: [R] Accelerating binRead

2016-09-18 Thread Philippe de Rochambeau
Please find below code that attempts to read ints, longs and floats from a binary file (which is a simplification of my original program). Please disregard the R inefficiencies, such as using rbind, for now. I’ve also included Java code to generate the binary file. The output shows that, at one po

Re: [R] Accelerating binRead

2016-09-18 Thread Philippe de Rochambeau
The only difference between the below code and my program is that the former assumes that the file only contains one row of 10 ints + 10 floats , whereas my program doesn’t know in advance how many rows the file contains, unless it downloads it first and computes the potential number of rows bas

Re: [R] Accelerating binRead

2016-09-18 Thread Philippe de Rochambeau
Hi Jim, this is exactly the answer I was look for. Many thanks. I didn’t R had a pack function, as in PERL. To answer your earlier question, I am trying to update legacy code to read a binary file with unknown size, over a network, slice up it into rows each containing an integer, an integer, a