[R] tikzDevice and sans serif

2011-11-26 Thread Thomas S. Dye
Aloha all, I haven't been able to find how to choose the font used by tikzDevice. My first tries have all been set with a serif font and I'd like to have them use the sans serif font instead. I've looked through the documentation and googled a bit without success. Is this possible? Can someone p

Re: [R] sqldf if iif

2011-11-26 Thread Jeff Newmiller
sqldf uses the SQLite database by default for backend processing. The "iif" function is specific to the Jet database engine syntax (which underlies MS Access). You could read up on SQLite syntax, or you could avoid using nonstandard SQL syntax, retrieve the data into a data frame, and use R code

Re: [R] computationally singular error with mice()

2011-11-26 Thread Fei
Hi Josh, You opened the blackbox up to me. Now I know what is the right way to go. Thank you so much! Best, Fei -- View this message in context: http://r.789695.n4.nabble.com/computationally-singular-error-with-mice-tp4109583p4111537.html Sent from the R help mailing list archive at Nabble.com.

[R] nnet plot

2011-11-26 Thread RMSOPS
good night Again I ask for help to the community, as I am new at this, I have some basic questions. I am looking for packages on neural networks and so you can search found these two that I think are the most used, neuralnet, nnet. So you can test, and correct me if I'm wrong the neuralnet

[R] generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})

2011-11-26 Thread Michael Kao
Dear R-help, I have been trying really hard to generate the following vector given the data (x) and parameter (alpha) efficiently. Let y be the output list, the aim is to produce the the following vector(y) with at least half the time used by the loop example below. y[1] = alpha * x[1] y[2]

[R] sqldf if iif

2011-11-26 Thread Carlos Rivera
Dear all, I have problems with iif function using sqldf library. I counted abundance (Num) of different "SPECIES" in two moments (esf) saving the information in two Tables (esf50, esf100): esf50 SAMPLE SPECIES Num esf 1289diso1 44

Re: [R] Boxplot

2011-11-26 Thread David Winsemius
On Nov 27, 2011, at 12:15 AM, Jeffrey Joh wrote: I'm trying to do the second case among Jim's suggestions. I used Bert's suggestion and it works great. I would also like to ask if anyone is familiar with a package for making box-plots. I would like to bin my datapoints at defined X i

[R] Boxplot

2011-11-26 Thread Jeffrey Joh
I'm trying to do the second case among Jim's suggestions.  I used Bert's suggestion and it works great. I would also like to ask if anyone is familiar with a package for making box-plots.  I would like to bin my datapoints at defined X intervals and display a boxplot for each bin on the same c

Re: [R] data.table merge equivalent for all.x

2011-11-26 Thread Dennis Murphy
Hi: There may well be a more efficient way to do this, but here's one take. library('data.table') # Want to merge by D in the end, so set D as part of the key: t1 <- data.table(ID = 11:20, A = rnorm(10), D = 1:10, key = "ID, D") t2 <- data.table(ID2 = 1:10, D = rep(1:5, 2), B = rnorm(10), key = "

Re: [R] Question about randomForest

2011-11-26 Thread Weidong Gu
Hi Matthew, The error rate reported by randomForest is the prediction error based on out-of-bag OOB data. Therefore, it is different from prediction error on the original data since each tree was built using bootstrap samples (about 70% of the original data), and the error rate of OOB is likely h

Re: [R] simplify source code

2011-11-26 Thread Dennis Murphy
Hi: Here's one way you could do it. I manufactured some fake data with a simple model to illustrate. This assumes you are using the same model formula with the same starting values and remaining arguments for each response. dg <- data.frame(x = 1:10, y1 = sort(abs(rnorm(10))), y

Re: [R] computationally singular error with mice()

2011-11-26 Thread Joshua Wiley
Hi Fei, On Sat, Nov 26, 2011 at 9:07 AM, Fei wrote: > Hi Josh, > > Thanks for the kind reminder of posting the dataframe on. My dataframe > contains lots of categorical variables, which seems to be problematic.  For > instance, > > dob        status         edu               mrext >      mar

[R] data.table merge equivalent for all.x

2011-11-26 Thread ONKELINX, Thierry
Dear all, I'm trying to use data.table to summarise a table and merge it to another table. Here is what I would like to do, but by using data.table() in a proper way. library(data.table) tab1 <- data.table(ID = 11:20, A = rnorm(10), D = 1:10, key = "ID") tab2 <- data.table(ID2 = 1:10, D = rep(1

Re: [R] append to PDF file

2011-11-26 Thread jim holtman
There is the 'pdftk' (PDF tool kit) that you will find on the web that will do the job. I have used it to both combine and split out the pages in the PDF file. On Sat, Nov 26, 2011 at 5:51 PM, Ken wrote: > PDF files contain information at the end of them and so you cannot append > without alter

Re: [R] append to PDF file

2011-11-26 Thread Ken
PDF files contain information at the end of them and so you cannot append without altering the file (universally true for PDF). Perhaps pdf() your plots and use external tools to convert the PDFs to .ps then re-merge. Might not be the best way, but an effective one. Ken Hutchison O

[R] append to PDF file

2011-11-26 Thread Christof Kluß
Hi is there a way to append a plot as PDF to an existing PDF file? savePlot seems not to have this possibility. Christof __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pr

[R] simplify source code

2011-11-26 Thread Christof Kluß
Hi I would like to shorten mod1 <- nls(ColName2 ~ ColName1, data = table, ...) mod2 <- nls(ColName3 ~ ColName1, data = table, ...) mod3 <- nls(ColName4 ~ ColName1, data = table, ...) ... is there something like cols = c(ColName2,ColName3,ColName4,...) for i in ... mod[i-1] <- nls(ColName[i]

Re: [R] computationally singular error with mice()

2011-11-26 Thread Fei
Hi Weidong, Thank you for the clear explanation. You are right it is not the categorical variables that are causing the trouble. It might be the relatively small number of sample that causing the problem given so many variables. I tried to exclude some variables that are not essential to all the a

[R] Question about randomForest

2011-11-26 Thread Matthew Francis
I've been using the R package randomForest but there is an aspect I cannot work out the meaning of. After calling the randomForest function, the returned object contains an element called prediction, which is the prediction obtained using all the trees (at least that's my understanding). I've check

Re: [R] computationally singular error with mice()

2011-11-26 Thread Weidong Gu
Hi Fei, I wouldn't worry to much about categorical variables for mice. Mice would use logisitic regression for binary and polytomous logistic regression for categorical variables with >2 levels. However, you should not include factors with a lot of levels, saying>30, in imputation models because i

Re: [R] Missing data?

2011-11-26 Thread Gabor Grothendieck
On Tue, Nov 22, 2011 at 6:50 PM, Kevin Burton wrote: > Void of any other suggestions this approach makes sense but for my case I > think I need to use zoo objects rather than xts. If I sequence the data > generally I don't know if there will be 365 days in the year or 366. So I > have to sequence

Re: [R] Time series merge?

2011-11-26 Thread Hasan Diwan
Try xts (tsObj, order.by=index (tsobj)) On Nov 26, 2011 10:57 AM, "Kevin Burton" wrote: > I have two time series > > > > a <- ts(1:10, start=c(1,6), end=c(2,5), frequency=10) > > b <- ts(1:5, start=c(2,1), end=c(2,5), frequency=10) > > > > Obviously 'b' is a subset of 'a'. I want a single index v

Re: [R] Missing data?

2011-11-26 Thread R. Michael Weylandt
Why do you need to use a frequency attribute for these data? The point of the zoo/xts line of time series implementations is that the time stamps are carried through for each observation (unlike ts) and can be irregular. Both classes exist precisely to avoid being forced into a frequency attribute.

Re: [R] how "big" (in RAM and/or disk storage) is each of these objects in a list?

2011-11-26 Thread John
On Sat, 26 Nov 2011 12:41:08 -0600 Paul Johnson wrote: > Greetings, friends (and others :) ) > > We generated a bunch of results and saved them in an RData file. We > can open, use, all is well, except that the size of the saved file is > quite a bit larger than we expected. I suspect there's s

Re: [R] SPSS -> R

2011-11-26 Thread John Fox
Dear Kristi, I assume that this is a repeated-measures ANOVA with one within-subjects factor (Time) and two between-subjects factors (Age and Sex, which are crossed). If Age is numeric, and not a factor, then the "type-III" tests that you requested don't test sensible hypotheses. In any event, if

Re: [R] SPSS -> R

2011-11-26 Thread R. Michael Weylandt
Perhaps this website and the associated book will be of help: http://r4stats.com/ Michael On Nov 26, 2011, at 11:08 AM, Kristi Shoemaker wrote: > I'm an SPSS user trying to make the transition to R. > > Can someone help me translate the following SPSS code into R?: > > > GLM Total_tp1 Tota

Re: [R] SPSS -> R

2011-11-26 Thread Frank Harrell
If you know SPSS already why not learn R modeling syntax and do this yourself? If ALPHA(.05) implies that you are using stepwise variable selection note that this is an invalid statistical technique. Frank Kristi Shoemaker wrote > > I'm an SPSS user trying to make the transition to R. > > Can

Re: [R] how "big" (in RAM and/or disk storage) is each of these objects in a list?

2011-11-26 Thread Duncan Murdoch
On 11-11-26 1:41 PM, Paul Johnson wrote: > We generated a bunch of results and saved them in an RData file. We > can open, use, all is well, except that the size of the saved file is > quite a bit larger than we expected. I suspect there's something > floating about in there that one of the packa

Re: [R] computationally singular error with mice()

2011-11-26 Thread Fei
Hi Josh, Thanks for the kind reminder of posting the dataframe on. My dataframe contains lots of categorical variables, which seems to be problematic. For instance, dobstatus edu mrext married highschool yes, full time Do you know how to specify t

Re: [R] Need some vectorizing help

2011-11-26 Thread Scott Tetrick
Thank you very much David - R is so rich, the easy way can be hard to find. Just to close this out for others, the final solution I used was: Peak2Return <- function(v) { S <- cummax(v) L <- which((v ==S) & (diff(c(0,v)<0)) R <- sapply(v[L], function(x,S) {which(x < S)[1]; }, S) now you h

[R] SPSS -> R

2011-11-26 Thread Kristi Shoemaker
I'm an SPSS user trying to make the transition to R. Can someone help me translate the following SPSS code into R?: GLM Total_tp1 Total_tp2 WITH Age Sex   /WSFACTOR=Time 2 Repeated   /METHOD=SSTYPE(3)   /CRITERIA=ALPHA(.05)   /WSDESIGN= Time   /DESIGN= Age Sex Age*Sex. Also. can anyone recommen

[R] how "big" (in RAM and/or disk storage) is each of these objects in a list?

2011-11-26 Thread Paul Johnson
Greetings, friends (and others :) ) We generated a bunch of results and saved them in an RData file. We can open, use, all is well, except that the size of the saved file is quite a bit larger than we expected. I suspect there's something floating about in there that one of the packages we are us

Re: [R] Time series merge?

2011-11-26 Thread Kevin Burton
Seems to work fine. Thank you. -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Saturday, November 26, 2011 10:11 AM To: Kevin Burton Cc: r-help@r-project.org Subject: Re: [R] Time series merge? On Sat, Nov 26, 2011 at 10:55 AM, Kevin Burton wrote: > I

Re: [R] cumsum in 3d arrays

2011-11-26 Thread David Winsemius
On Nov 26, 2011, at 11:24 AM, David Winsemius wrote: On Nov 26, 2011, at 9:32 AM, zloncaric wrote: Hello! Is it posible to apply /cumsum()/ along the 3rd dimension of 3D array? Something like matrlab function - /cumsum (*A*,dim)/ which returns the cumulative sum of the elements along th

Re: [R] cumsum in 3d arrays

2011-11-26 Thread David Winsemius
On Nov 26, 2011, at 9:32 AM, zloncaric wrote: Hello! Is it posible to apply /cumsum()/ along the 3rd dimension of 3D array? Something like matrlab function - /cumsum (*A*,dim)/ which returns the cumulative sum of the elements along the dimension of *A* specified by scalar dim. `apply` lets

Re: [R] plot xy data

2011-11-26 Thread David Winsemius
On Nov 25, 2011, at 11:27 PM, sutada Mungpakdee wrote: Hi, Has anyone know about how to get the correct plot? I have use this R script (as below), so I expect the plot is based on x axis, but the result was opposite. Any suggestion will be great. You question doesn't make clear what you e

Re: [R] cumsum in 3d arrays

2011-11-26 Thread Ben Bolker
zloncaric biologija.unios.hr> writes: > Is it posible to apply /cumsum()/ along the 3rd dimension of 3D array? > Something like matrlab function - /cumsum (*A*,dim)/ which returns the > cumulative sum of the elements along the dimension of *A* specified by > scalar dim. Check out the combinat

Re: [R] Time series merge?

2011-11-26 Thread Gabor Grothendieck
On Sat, Nov 26, 2011 at 10:55 AM, Kevin Burton wrote: > I have two time series > > > > a <- ts(1:10, start=c(1,6), end=c(2,5), frequency=10) > > b <- ts(1:5, start=c(2,1), end=c(2,5), frequency=10) > > > > Obviously 'b' is a subset of 'a'. I want a single index value indicating > where that start

[R] Time series merge?

2011-11-26 Thread Kevin Burton
I have two time series a <- ts(1:10, start=c(1,6), end=c(2,5), frequency=10) b <- ts(1:5, start=c(2,1), end=c(2,5), frequency=10) Obviously 'b' is a subset of 'a'. I want a single index value indicating where that start of 'b' lines up with the start of 'a'. So in this simple example I wou

[R] cumsum in 3d arrays

2011-11-26 Thread zloncaric
Hello! Is it posible to apply /cumsum()/ along the 3rd dimension of 3D array? Something like matrlab function - /cumsum (*A*,dim)/ which returns the cumulative sum of the elements along the dimension of *A* specified by scalar dim. Thanks in advance Željka -- View this message in context:

Re: [R] dir.create() does not create directory

2011-11-26 Thread R. Michael Weylandt
I'm not a Windows man, but have you tried in the R CLI or GUI rather than Eclipse? That would help narrow down the problem. Also, if you could provide a minimal example for those who have Windows boxes that'd be great - though admittedly it sounds hard here. As an outline, something like: se

[R] dir.create() does not create directory

2011-11-26 Thread syrvn
Hello, I am running Windows 7 and R-2.13 in StatET. When I try to create a directory it does not print any errors but if I check outside eclipse if it exists or do a refresh in Eclipse the directory is not been created. The strange thing is that it happens only to some sub-folders... On the othe

Re: [R] Constrained linear regression

2011-11-26 Thread Bert Gunter
Sounds like it is or could be considered a mixtures problem. Check out the FlexMix package, which looks like it should do exactly what you want. (But maybe not, so look carefully). -- Bert On Sat, Nov 26, 2011 at 6:10 AM, Julia Lira wrote: > > Dear all, > I need to run a simple linear regressio

[R] Constrained linear regression

2011-11-26 Thread Julia Lira
Dear all, I need to run a simple linear regression such that: y = b0 + b1*x1 + (1-b1)*x2 + e which I know I can use: lm(y ~ I(x1 - x2) + offset(x2)). However, I also need to restrict the coefficient b1 to be between 0 and 1. Is there any way to include such restriction in the linear regression es

Re: [R] Why it is happeing?

2011-11-26 Thread Kehl Dániel
"Note that current implementations of*R*use 32-bit integers for integer vectors, so the range of representable integers is restricted to about/+/-2*10^9/:|double |s can hold much larger integers exactly." hth d 2011-11-26 1

[R] Why it is happeing?

2011-11-26 Thread Christofer Bogaso
Dear all, I had following calculations with R: > x = vector(length = 4) > x[1] = 1 > x[2] = 3 > x[3] = 123456789123456 > x[4] = -9876543219876 > as.integer(x) [1] 1 3 NA NA Warning message: NAs introduced by coercion What went wrong? Thanks and regards,