Re: [R] Using !is.na() in a HAVING clause in sqldf() XXXX
Did you try a where statement? where Premie is not null On Tue, Jan 17, 2012 at 3:03 PM, Dan Abner dan.abne...@gmail.com wrote: Hi everyone, I have the following: sqldf(select Premie,count(tpounds) N,avg(tpounds) Avg_Weight, stddev_samp(tpounds) StdDev from children group by Premie having !is.na(Premie)) sqldf() does not like the !is.na(Premie) specification. How does one exclude a missing group in an aggregated query using sqldf()? Thanks! Dan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joseph C. Magagnoli [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem loading rJava...
Brian, I believe I had a similar problem. Make sure you have JDK (*sun-java6-jdk) * installed as well. Here is a link to a JDK install guide http://www.cyberciti.biz/faq/howto-ubuntu-linux-install-configure-jdk-jre/ On Mon, Aug 15, 2011 at 10:18 AM, Brian Lunergan ff...@ncf.ca wrote: Morning All: Having problems installing this one into my R setup and wondered if anyone on the list had the same problem and found a workable solution. First to the system particulars: OS is the Hardy Heron edition of Ubuntu Linux R version is 2.13.1 Java installation is sun-java6 Next up is the result of javareconf: R CMD javareconf Java interpreter : /usr/bin/java Java version : 1.5.0 Java home path : /usr/lib/jvm/java-1.5.0-gcj-4.2-1.5.0.0/jre Java compiler: /usr/bin/javac Java headers gen.: /usr/bin/javah Java archive tool: /usr/bin/jar Java library path: /usr/lib/../lib/gcj-4.2-81:/usr/lib/jni JNI linker flags : -L/usr/lib/../lib/gcj-4.2-81 -L/usr/lib/jni -ljvm JNI cpp flags: Updating Java configuration in /etc/R Done. What little I've been able to find on this problem suggests that the blank space beside the cpp flags variable is the key point, but all the notes I found suggest programming solutions outside of my abilities. Are there any simple and to the point solutions that correct this issue, or am I SOL for using the package? Any help would be greatly appreciated as install of other packages and R commander plugins depend on solving it. Oh, yes. Here's the result when I try to pull in rJava. install.packages() Loading Tcl/Tk interface ... done --- Please select a CRAN mirror for use in this session --- Installing package(s) into /usr/local/lib/R/site-library (as lib is unspecified) trying URL 'http://cran.skazkaforyou.com/src/contrib/rJava_0.9-1.tar.gz' Content type 'application/x-gzip' length 527197 bytes (514 Kb) opened URL == downloaded 514 Kb * installing *source* package rJava ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for string.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for unistd.h... (cached) yes checking for an ANSI C-conforming const... yes checking whether time.h and sys/time.h may both be included... yes configure: checking whether gcc supports static inline... yes checking whether setjmp.h is POSIX.1 compatible... yes checking whether sigsetjmp is declared... yes checking whether siglongjmp is declared... yes checking Java support in R... present: interpreter : '/usr/bin/java' archiver: '/usr/bin/jar' compiler: '/usr/bin/javac' header prep.: '/usr/bin/javah' cpp flags : '' java libs : '-L/usr/lib/../lib/gcj-4.2-81 -L/usr/lib/jni -ljvm' configure: error: One or more Java configuration variables are not set. Make sure R is configured with full Java support (including JDK). Run R CMD javareconf as root to add Java support to R. If you don't have root privileges, run R CMD javareconf -e to set all Java-related variables and then install rJava. ERROR: configuration failed for package rJava * removing /usr/local/lib/R/site-library/rJava The downloaded packages are in /tmp/Rtmph5lTVR/downloaded_packages Warning message: In install.packages() : installation of package 'rJava' had non-zero exit status -- Brian Lunergan Nepean, Ontario Canada __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joseph C. Magagnoli [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide
[R] [R} R install on Unix Server
Hi all, I am hoping to get R installed configured at work, on an HP-Unix server. R was installed but was not configured correctly because we do not have a Fortran compiler for HP unix. The IT guys sent me an email with some questions that I hope to get some help in anwsering. We need the information for R software that it is really compatible with hpux or not . If compatible , then which version of hpux reqd ? what are other dependency to load R ? What will be the patch level and FORTRAN version ? Also is there any other s/w equivalent to R which can be tested on hpux ? -- Joseph C. Magagnoli [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linux Editor
In addition, there is SciViews for Komodo edit http://www.sciviews.org/SciViews-K/ Joe On Mon, Aug 2, 2010 at 10:35 AM, alphaace rsa...@comcast.net wrote: Hi Everyone, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way to use R was through EMACS using something like ESS. I remember that being serviceable but not always the most convenient. Is there anything comparable to the mac version of R with its built in console, editor, etc?? thanks! -- View this message in context: http://r.789695.n4.nabble.com/Linux-Editor-tp2310432p2310432.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Book on R's Programming Language
Matt, you might want to check out programming with data by John Chambers. http://www.amazon.com/Programming-Data-Guide-S-Language/dp/0387985034/ref=sr_1_1?ie=UTF8s=booksqid=1279990404sr=8-1 Best Joe On Sat, Jul 24, 2010 at 11:39 AM, Matt Stati mattst...@yahoo.com wrote: Can someone please recommend to me a book on the programming language that R is based on? I'm looking for a foundational book that teaches the logic of the S language. It seems that knowing the underpinnings of the language can only make using R a bit easier. Any leads are greatly appreciated . . . Matt. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joseph C. Magagnoli Doctoral Student Department of Political Science University of North Texas 1155 Union Circle #305340 Denton, Texas 76203-5017 Email: jcm0...@unt.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux - a primer
I would have to agree with Mike Miller. As a novice to both R and Linux I choose to use Ubuntu. The substantial amount of help guides and forums really made the transition easier and will save some frustration. Once you get used to linux you can always try a different distribution later, if you want. Joe On Mon, Mar 15, 2010 at 2:43 PM, Mike Miller mbmille...@gmail.commbmiller%...@gmail.com wrote: On Sun, 14 Mar 2010, Jonathan Baron wrote: Just to make this thoroughly confusing, I will say that I am very happy with Fedora Just to make this less confusing: choose Ubuntu. I say this because it is easy to use, has great repositories and it is the most popular Linux distro, so it should be easy to get help with it. I have been running it on a number of machines doing a few different kinds of tasks and it has almost always been very easy to install. I'm also happily running the Ubuntu Netbook Remix on a little Asus EeePC netbook. To install R, just use the Synaptic program: https://help.ubuntu.com/community/SynapticHowto It couldn't be easier. I don't work for Ubuntu and I don't have any friends or relatives working there either. Mike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joseph C. Magagnoli Doctoral Student Department of Political Science University of North Texas 1155 Union Circle #305340 Denton, Texas 76203-5017 Email: jcm0...@unt.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stata and R user GLM method
Jean-Baptiste The most immediate difference I see is that you use a logit link in the R code but a probit link function in the stata code. Joe On Fri, Jan 22, 2010 at 8:25 AM, Jean-Baptiste Combes jbcom...@laposte.netwrote: Hello people, I am in the process of migrating from Stata to R and I would like to check if my results are similar under the two softwares: Here is my GLM command under R nurse.model-glm(pQSfteHT~dQSvacrateHTQuali3_2 + dQSvacrateHTQuali3_3 + dQSvacrateHTQuali3_4 + dQSvacrateHTQuali3_5 + cluster_32 + cluster_33 + cluster_34 ,family=binomial(link = logit)) and below the stata command glm pQSfteHT dQSvacrateHTQuali3_2 dQSvacrateHTQuali3_3 dQSvacrateHTQuali3_4 dQSvacrateHTQuali3_5 cluster_32 cluster_33 cluster_34, link(probit) family(binomial) robust Apart from the robust option, it seems to me from what I understand that I should get the same things. Stata output: *Second model (N=690* *Coef.* *p-value* Constant** 0.241*** 0.000 QVSV0 0.076*** 0.001 SVQV0 0.071** 0.027 QVSV=0 0.051** 0.019 SVQV=0 0.042 0.368 Mental Health HTs -0.226*** 0.000 Acute Teaching HTs 0.159*** 0.000 Other HTs 0.084 0.200 R output (Sorry for the presentation, but I am not able at the moment to produce nice tables, the variables are in the same order as above) Call: glm(formula = pQSfteHT ~ dQSvacrateHTQuali3_2 + dQSvacrateHTQuali3_3 + dQSvacrateHTQuali3_4 + dQSvacrateHTQuali3_5 + cluster_32 + cluster_33 + cluster_34, family = binomial(link = logit)) Deviance Residuals: Min 1Q Median 3Q Max -2.297e+00 2.107e-08 2.107e-08 6.275e-06 3.850e-01 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 4.476e+01 1.950e+04 0.0020.998 dQSvacrateHTQuali3_2 -1.112e+00 2.136e+04 -5.21e-051.000 dQSvacrateHTQuali3_3 -5.365e-01 2.576e+04 -2.08e-051.000 dQSvacrateHTQuali3_4 -2.011e+01 1.693e+04-0.0010.999 dQSvacrateHTQuali3_5 -6.509e-01 4.040e+04 -1.61e-051.000 cluster_32 -3.194e-01 1.788e+04 -1.79e-051.000 cluster_33 -2.857e-02 2.475e+04 -1.15e-061.000 cluster_34 -2.209e+01 9.666e+03-0.0020.998 (Dispersion parameter for binomial family taken to be 1) Null deviance: 15.0690 on 688 degrees of freedom Residual deviance: 7.2049 on 681 degrees of freedom AIC: 23.205 Number of Fisher Scoring iterations: 24 My suggestion is that I have something wrong with my data under R (I am confident with the Stata results). What do you think? I am not expecting you to solve my problem as I reckon it is a bit difficult for you as you do not know the data, I just would like an opinion on the differences found between the two softwares, do you agree that there is something wrong? Thank you for reading this e-mail. I would like to thank you in advance and alos the people who answered my previous e-mail that was very kind of you. Jean-Baptiste [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joseph C. Magagnoli Doctoral Student Department of Political Science University of North Texas 1155 Union Circle #305340 Denton, Texas 76203-5017 Email: jcm0...@unt.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reshaping data
Hi all, I have a dataframe that has one observation per case. for example: CaseStartyear Endyear A 1979 1989 B 1950 1955 I would like to create a dataframe in which each case has multiple observations corresponding to the start and end year for example Case Year A 1979 A 1980 A 1981 . . . . . . A1989 B1950 B 1951 and so on any help would be greatly appreciated. Joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] kaplan-meier error
Hi all, I am getting an error in my code and I don't know what the problem is. I am using R 2.9 on ubuntu. my code is as follows: ## Libraries ## library(survival) library(foreign) ## reading data ## data-read.dta(http://psfaculty.ucdavis.edu/bsjjones/cabinet.dta;) head(data) attach(data) fit1-survfit(Surv(durat,censor)) and I get the following error fit1-survfit(Surv(durat,censor)) Error in survfit(Surv(durat, censor)) : Survfit requires a formula or a coxph fit as the first argument any help is greatly appreciated Joe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Generating a count variable
Dear All, I am practicing data manipulation and I would like to generarte a count variable. My data looks like this: Country MID 1 NA 10 10 11 10 20 21 20 20 20 I would like to to generate a variable that counts the periods of zeros in the MID variable for each country for example: Country MIDCount 1 NA 101 102 110 101 201 210 201 202 203 I am used to doing my data manipulation in stata but I want to try learn to do it in R. Thank you for your help joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] arma model with garch errors
Dear R experts, I am trying to estimate an ARMA 2,2 model with garch errors. I used the following code on R 2.9. #library library(fGarch) #data data1-ts(read.table(C:/Users/falcon/Desktop/Time Series/exports/goods1.csv), start=c(1992,1), frequency=12) head(data1) #garch garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1) but get this error: garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1) Error in garchFit(formula.mean = ~arma(2, 2), formula.var = ~garch(1, : element 1 is empty; the part of the args list of 'length' being evaluated was: (formula) what am I doing wrong? any help would be greatly appreciated joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R} seasonal differencing
Hi all, I was wondering how to construct a seasonal differenced time series variable. I used the following code to construct a 12 span seasonal difference seasonal-diff(V2, lag=12, differences=1) is this correct? thank you in advance joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing R on Ubuntu
When I use ubuntu linux and R I use komodo edit with an R extension. Seems really similar to tinn-R. http://www.sciviews.org/SciViews-K/index.html joe On Sun, Feb 8, 2009 at 8:56 AM, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: Amendment/Question #1: When I update.packages(), it tells me that rgl fails to update because it can't find X11. Again, I'm pretty new to Ubuntu, but it looks like X comes with Ubuntu. I see files under /etc/X11. Does this mean I need to download x11-common (or x11-apps, or x11-utils, or one of the others?) with the Synaptic Package Manager? I hesitate on this because it seems like X11 is not a simple add-on package, but something core to Ubuntu. Any help is appreciated. Thanks. -- View this message in context: http://www.nabble.com/installing-R-on-Ubuntu-tp10025949p21899658.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] glm package
Hi all, can the glm package be used to estimate a logit model to panel data? I am asking this because stata has a standard logit model and then an xtlogit for longitudinal data. Is there something similar in R? Thank you jcm [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dynamic random effects model
I am trying to estimate a model of third party intervention into civil war. The data is panel data structure. The unit of analysis is civil war year. For each civil war year my dependent variable is coded 0=no intervention and 1=intervention. I want to use a lagged dependent variable as an independent variable and i am including other variables such as type of war conventional=0,1 dummy irregular 0,1 dummy,,, other dummy variables such as cold war period, and other variables such as state strength . Some of my independent variables are time invariant or slow moving. Because i want to include lagged dependent variable rules out a fixed effect, therefore I was thinking of using random effects.Any suggestion on how to model this? I am inexperienced with these models, I will appreciate any help I can get Thank you jcm On Thu, Jan 29, 2009 at 8:04 AM, Ben Bolker bol...@ufl.edu wrote: Joseph Magagnoli jcm331 at gmail.com writes: All R experts, How do I fit a dynamic Random effects model with a binary dependent variable in R Thanks JCM You haven't given us nearly enough information to go on. If you're talking about something like a state-space model with a binary response, I would probably say your best bet is a Bayesian approach, prob. via JAGS/R2jags or WinBUGS/R2WinBUGS. (A lot) more context will give a higher probability of a useful answer. good luck Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dynamic random effects model
All R experts, How do I fit a dynamic Random effects model with a binary dependent variable in R Thanks JCM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] log likelihood
Hi all, I ran a Weibull model, and I am wondering if there is any way to extract the log likelihood. I tried loglik(model) but it does not seem to work any help would be greatly appreciated joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] log likelihood
Hi all, I ran a Weibull model, and I am wondering if there is any way to extract the log likelihood. I tried loglik(model) but it does not seem to work any help would be greatly appreciated joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] negative binomial predicted probabilities
I estimated a negative binomial model using zelig. z.out- zelig(NEWBHC~ PW80 + CHNGBLK + XBLK,data=data, model=negbin) How do I calculate predicted probabilities for this model? Is it the same process as a poisson regression? Thanks in advance Joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.