Re: [R] computation

2014-01-13 Thread PIKAL Petr
Hi Those have zero and dividing by zero produces NA (dg0%*%t(dx0)) [,1] [,2] [1,]0 -0.75 [2,]0 0.50 (dx0%*%t(dg0)) [,1] [,2] [1,] 0.00 0.0 [2,] -0.75 0.5 NAs propagates in further computation. Regards Petr -Original Message- From:

Re: [R] tables package and alternative to col percent

2014-01-13 Thread Duncan Murdoch
On 14-01-13 12:02 AM, Daniel Cher wrote: Library tables and tabular function is neato. I'm trying to figure out how to get percents other than just row and columns. I'd like a percent of a factor. That's a recent addition, still only on R-forge. library(tables) c=data.frame(

[R] To modify FMCD

2014-01-13 Thread Hock Ann Lim
Dear R Experts, Can anyone teach me how to modify the FMCD algorithm in R. If I wish to replace the C-step in FMCD by the index set. Let I(old)={pi(1)old,pi(2)old,...,p(h)old} and I(new)={pi(1)new, pi(2)new,..,p(h)new} the index sets that correspond to the sample items in H(old) and H(new)

Re: [R] computation

2014-01-13 Thread Lisa S
In this calculation: (dg0%*%t(dx0)) is [,1] [,2] [1,]0 -0.75 [2,]0 0.50 So: exp2 = NaN It is extremely easy to find out the issue if you go back line by line, this is a basic procedure of debugging. Please do it yourself next time. On Mon, Jan 13, 2014 at 3:09 PM, IZHAK

Re: [R] Find the package of a class given classname

2014-01-13 Thread Hadley Wickham
How to find the package of a class given classname? For example, there is a class called GAlignments, I want to do something like attr(GAlignments, package) that gives you the package where the class is defined? But of course, attr(GAlignments, package) won't work... You didn't say whether

[R] Re. Confidence intervals for prediction with R2Bayesx

2014-01-13 Thread garth
Hello, I am using the R2Bayesx package to fit a GAM to time-series data and then using this model to extrapolate beyond the extent of the time-series. The prediction.bayesx function works quite well to predict the series, but does not seem to provide uncertainty estimates for the prediction.

Re: [R] HOW TO CREATE A SUBSET FROM A LARGE DATASET based on some conditions

2014-01-13 Thread arun
Hi, Try: dat1 - read.table(text=2008 India ..  ..   .. .. .. 2009 India -   -   -   -   -  2010 India 5 1 6 0 -  2011 India 20 2 21 2 2 2012 India 35 4 42 3 5 2013 India 88 10 74 6  ..  2008 Brazil 3 2 .. .. 2 2009 Brazil 6 4 -   -   4,sep=,header=FALSE,stringsAsFactors=FALSE) dat2 -

Re: [R] R riddle

2014-01-13 Thread arun
Hi, Try: dat1 - read.table(text=I V3 X210505 X210505.1 X417802 X417802.1 X420385 X420385.1 X420480 X420480.1  A  A3205   B A   B A   B A   B A  M  A3662   A B   B B   A B   B B  M AR0012  

[R] tcltk makes R crash under Mavericks

2014-01-13 Thread Claudia Tebaldi
Hello I was just forced to upgrade my OS X to Mavericks. Everything seemed to be OK, R still worked seemingly fine within emacs (am using the latest version, R 3.0.2, and the latest version of ESS, with Emacs 24.3.1) until I tried loading the library extRemes. Apparently the call within that

Re: [R] tcltk makes R crash under Mavericks

2014-01-13 Thread Berend Hasselman
On 13-01-2014, at 19:30, Claudia Tebaldi claudia.teba...@gmail.com wrote: Hello I was just forced to upgrade my OS X to Mavericks. Everything seemed to be OK, R still worked seemingly fine within emacs (am using the latest version, R 3.0.2, and the latest version of ESS, with Emacs 24.3.1)

Re: [R] tcltk makes R crash under Mavericks

2014-01-13 Thread Claudia Tebaldi
Yes, thank you, as I said I did reinstall R and tcltk. That's not the problem. For some reason loading the package still makes R crash. Claudia Tebaldi Project Scientist, CGD/NCAR and Science Fellow Climate Central (303) 497 1710 w (303) 775 5365 c On Mon, Jan 13, 2014 at 11:51 AM, Berend

Re: [R] tcltk makes R crash under Mavericks

2014-01-13 Thread Berend Hasselman
On 13-01-2014, at 19:53, Claudia Tebaldi claudia.teba...@gmail.com wrote: Yes, thank you, as I said I did reinstall R and tcltk. That's not the problem. Look at what you wrote: I tried reinstalling everything (R and the packages, and the tools' tcltk package -- even if I think it should

Re: [R] tcltk makes R crash under Mavericks

2014-01-13 Thread John Fox
Dear Claudia, The R Commander installation notes at http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html have some information (near the bottom) about trouble-shooting tcltk problems on Mac OS X. Maybe they will help. Best, John

[R] Barplot not showing all labels

2014-01-13 Thread Jeff Johnson
I have a table that consists of the following country codes and frequencies: AE AN AR AT AU BB BD BE BH BM BN BO BR BS CA CH CM CN CO CR CY DE DK DO EC ES 0 3 0 2 1 31 4 1 1 1 45 1 1 4 5 86 3 1 8 1 2 1 8 2 1 2 4 FI FR GB GR GU HK ID IE IL IN IO IT JM JP KH KR KY LU LV MO

[R] coxph with time-dependent covariates

2014-01-13 Thread Phil Stevenson
I am using the coxph() function (from the 'survival' package) for a data set that requires one of the covariates to be treated as time-dependent. The issue is with this data set is there are some covariate values that are missing at the time point when the event occurs. For example: Person A:

Re: [R] Barplot not showing all labels

2014-01-13 Thread Jim Lemon
On 01/14/2014 06:15 AM, Jeff Johnson wrote: I have a table that consists of the following country codes and frequencies: AE AN AR AT AU BB BD BE BH BM BN BO BR BS CA CH CM CN CO CR CY DE DK DO EC ES 0 3 0 2 1 31 4 1 1 1 45 1 1 4 5 86 3 1 8 1 2 1 8 2 1 2 4 FI FR GB

Re: [R] coxph with time-dependent covariates

2014-01-13 Thread David Winsemius
On Jan 13, 2014, at 10:50 AM, Phil Stevenson wrote: I am using the coxph() function (from the 'survival' package) for a data set that requires one of the covariates to be treated as time-dependent. The issue is with this data set is there are some covariate values that are missing at the time

[R] How to use ddply

2014-01-13 Thread Amitabh Dugar
I have never used R-help to pose a question to the R-users community; is sending this Email the right way to do so? I am trying to use the ddply function in the plyr package to accomplish the following: I have a data frame of the type:      ticker monthend_n wgtdiff    ret 156      AA  

[R] likelihood ratio test for mean difference assuming unequal variance

2014-01-13 Thread Amanda Li
Hello, I am so sorry, but I have been struggling with the code for the entire day. I have a very simple dataset that looks like this: response=c(45,47,24,35,47,56,29) sub=c(A,A,B,B,C,C,C£© time=c(1,2,1,2,1,2,3) gdata=cbind(response,sub,time) Namely, for three subjects, each has 2 or 3

Re: [R] How to use ddply

2014-01-13 Thread arun
Hi, Try: ddply(test,.(monthend_n),mutate,quintiles=cut(wgtdiff,5)) A.K. On Monday, January 13, 2014 5:32 PM, Amitabh Dugar cleverc...@yahoo.com wrote: I have never used R-help to pose a question to the R-users community; is sending this Email the right way to do so? I am trying to use the

Re: [R] SE for R-squared

2014-01-13 Thread peter dalgaard
On 12 Jan 2014, at 21:36 , John C Frain fra...@gmail.com wrote: Have a look at http://davegiles.blogspot.ie/2013/10/more-on-distribution-of-r-squared.html Or head directly for the Wikipedia page for the noncentral beta distribution (and/or noncentral F). Giles doesn't really do the

Re: [R] How to use ddply

2014-01-13 Thread David Winsemius
On Jan 13, 2014, at 1:29 PM, Amitabh Dugar wrote: I have never used R-help to pose a question to the R-users community; is sending this Email the right way to do so? I am trying to use the ddply function in the plyr package to accomplish the following: I have a data frame of the type:

Re: [R] Barplot not showing all labels

2014-01-13 Thread William Dunlap
If the problem is that not all y-axis labels fit on the horizontal barplot with the default settings, you can rotate then to horizontal with las=1 and reduce their size with cex.names=0.5 to avoid overlap, as in barplot(structure(1:50, names=state.name), horiz=TRUE,las=1, cex.names=0.5) or,

[R] Plot only a portion of a record

2014-01-13 Thread Janet Choate
Hi R community, i have a data frame of streamflow for 23 years, i.e. date year month day wy yd wyd modQ 1 1965-10-01 196510 1 1966 274 1 0.3341630 2 1965-10-02 196510 2 1966 275 2 0.3223247 3 1965-10-03 196510 3 1966 276 3 0.3109057 i only want to plot 1

Re: [R] Plot only a portion of a record

2014-01-13 Thread Jim Lemon
On 01/14/2014 11:39 AM, Janet Choate wrote: Hi R community, i have a data frame of streamflow for 23 years, i.e. date year month day wy yd wyd modQ 1 1965-10-01 196510 1 1966 274 1 0.3341630 2 1965-10-02 196510 2 1966 275 2 0.3223247 3 1965-10-03 196510 3

Re: [R] Plot only a portion of a record

2014-01-13 Thread David Winsemius
On Jan 13, 2014, at 4:39 PM, Janet Choate wrote: Hi R community, i have a data frame of streamflow for 23 years, i.e. date year month day wy yd wyd modQ 1 1965-10-01 196510 1 1966 274 1 0.3341630 2 1965-10-02 196510 2 1966 275 2 0.3223247 3 1965-10-03 1965

Re: [R] Plot only a portion of a record

2014-01-13 Thread arun
Hi Janet, You may also check library(xts).  mod.sage - read.table(text=date year month day  wy  yd wyd  modQ 1 1965-10-01 1965    10  1 1966 274  1 0.3341630 2 1965-10-02 1965    10  2 1966 275  2 0.3223247 3 1965-10-03 1965    10  3 1966 276  3 0.3459057 4 1965-10-04 1965    10  4 1966 277 

Re: [R] likelihood ratio test for mean difference assuming unequal variance

2014-01-13 Thread Ben Bolker
Amanda Li amandali at uchicago.edu writes: Hello, I am so sorry, but I have been struggling with the code for the entire day. I have a very simple dataset that looks like this: response=c(45,47,24,35,47,56,29) sub=c(A,A,B,B,C,C,C£© time=c(1,2,1,2,1,2,3)

[R] Running multidimensional regressions

2014-01-13 Thread andrews Nikolaiv
Dear R helpers!, I have a question on how to run a regression with many indices. To give you a practical example, let y_{itabp} be an dependent variable (representing prices) indexed by i=country, t=time, a=area, b=brand and p=package size. In particular, we collected prices on the

[R] squashed domains when doing PCA with bio3d

2014-01-13 Thread Bianca Ihrig
Hi everyone, I have been doing PCA using bio3d. My protein of interest has two domains and there are two crystal structures, one in a closed (domains are close together) and one in an open state (domains are nearly opposite each other). I ran MD simulations on both states and did PCA. When

Re: [R] squashed domains when doing PCA with bio3d

2014-01-13 Thread Tsjerk Wassenaar
Hi Bianca, If the domains are rotated between the trajectories, the motion cannot be captured by a single linear component. Think of projecting an arc on a straight line. You loose the (deflection) part on the second component. That looks like squashing. I've mentioned this in relation to MD

Re: [R] Running multidimensional regressions

2014-01-13 Thread David Winsemius
On Jan 13, 2014, at 4:28 PM, andrews Nikolaiv wrote: Dear R helpers!, I have a question on how to run a regression with many indices. To give you a practical example, let y_{itabp} be an dependent variable (representing prices) indexed by i=country, t=time, a=area, b=brand