Re: [R] Need very fast application of 'diff' - ideas?

2012-01-27 Thread R. Michael Weylandt
I'd write your own diff() that eliminates the method dispatch and argument checking that diff -> diff.default does. x[-1] - x[-len(x)] # is all you really need. (# you could also try something like c(x[-1], NA) - x which may be marginally faster as it only subsets x once but you should profile to

Re: [R] automated library location

2012-01-27 Thread R. Michael Weylandt
? libPaths ? .Library Not sure how easily that gets to your makefile though. Michael On Fri, Jan 27, 2012 at 7:35 PM, Matyas Sustik wrote: > Hi All, > > Is there a way to find out the R library location that I could use in > a script or > Makefile?  For example for octave the mkoctfile compiler

Re: [R] repeat function for entire list of matrices

2012-01-27 Thread R. Michael Weylandt
?lapply Perhaps (untested): lapply(listofmatrices, nested, method="binmatnest2") Michael On Fri, Jan 27, 2012 at 3:19 PM, pabears wrote: > hi all. > > perhaps someone can help me with subsetting here > > i'm trying to use the nested() function in the bipartite package.  my > proble

Re: [R] finding rows in a matrix that match a vector

2012-01-27 Thread Jason J. Pitt
Hi Melissa, Well, assuming you know the length of the length of the row in the matrix and vector are the same... if you need a quick fix you could use mine <- 1:6 table.combos <- matrix(data = 1:12, nrow = 2, ncol = 6, byrow = T) sum(mine == table.combos[1, ]) == length(mine) # returns TRUE

[R] gplot heatmap

2012-01-27 Thread khush ........
Hi, I am drawing a heat map using gplots of R package. The file (new4) is having values 0 and 1 only. library(gplots) library(marray) x=read.table("new4", header=TRUE) mat=data.matrix(x) heatmap.2(mat, col=colorRampPalette(c("black","red"))(256), #col=greenred(75), Rowv=TRUE, Colv=TRUE, distfun

[R] R-help mailing list submissions

2012-01-27 Thread Christopher Kelvin
R-help mailing list submissions [[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 commen

Re: [R] how to install the fbasics and use stablefit function?

2012-01-27 Thread Berend Hasselman
On 27-01-2012, at 21:00, zoezoe wrote: > hi, I have installed the fbasics package. And when I wrote "?stablefit", it > says 'No documentation for 'stablefit' in specified packages and libraries'. > When I tried "??stablefit", it showed that the stablefit is in > fBasics::Distributionfit. However,

[R] finding rows in a matrix that match a vector

2012-01-27 Thread Melrose2012
Hi, Please excuse my ignorance, but I am just learning R (this is my very first day programming in R) and having a really hard time figuring out how to do the following: I have a matrix that is 1000 row by 6 columns (named 'table.combos') and a 1 row by 6 column vector (named 'mine'). I want to

Re: [R] date arithmetic discrepancy

2012-01-27 Thread Berend Hasselman
On 27-01-2012, at 21:45, Ty Canuck wrote: > What accounts for the different result? > >> as.numeric(as.POSIXct("2012-01-13 08:10:00") - as.POSIXct("2012-01-13 > 00:00:00") , units='secs') > [1] 29400 > >> trunc(as.numeric(as.POSIXct("2012-01-13 08:10:00") - > as.POSIXct("2012-01-13 00:00:00") ,

Re: [R] convert sas date format

2012-01-27 Thread Johnny Liseth
I am relatively new to R and I have problem figuring out why the data file appear to be read in fine, but the one way ANOVA is not calculated correctly. In other problems this works fine. This program is listed at the end, and the small text file in online. There are 24 data points in three group

Re: [R] Looping column names

2012-01-27 Thread Rui Barradas
Hello, > But I keep getting this error: > Error in model.frame.default(formula = i ~ GC, data = gc2) : > variable lengths differ (found for 'GC') Simple: you are using a variable's name, not the variable itself Your code corrected should be res <- NULL for(i in colnames(gc2[,-1])){ te

[R] automated library location

2012-01-27 Thread Matyas Sustik
Hi All, Is there a way to find out the R library location that I could use in a script or Makefile? For example for octave the mkoctfile compiler has the following feature: Well? > mkoctfile -p LFLAGS -L/usr/lib/octave-3.2.4 This is quite useful to be used in Makefiles. I am compiling a dynami

[R] finding rows in a matrix that match a vector

2012-01-27 Thread Melissa Patrician
Hi, Please excuse my inexperience, but I am just learning R (this is my very first day programming in R) and having a really hard time figuring out how to do the following: I have a matrix that is 1000 row by 6 columns (named 'table.combos') and a 1 row by 6 column vector (named 'mine'). I wa

[R] Need very fast application of 'diff' - ideas?

2012-01-27 Thread Kevin Ummel
Hi everyone, Speed is the key here. I need to find the difference between a vector and its one-period lag (i.e. the difference between each value and the subsequent one in the vector). Let's say the vector contains 10 million random integers between 0 and 1,000. The solution vector will have 9

[R] R-Help

2012-01-27 Thread Christopher Kelvin
Can somebody help me, How do I generate data from the weibull distribution if the data contain both failure and interval censored, For example, I want to generate n=100, shape=2 and scale =4 with 30% interval censored. Thank you [[alternative HTML version deleted]] ___

Re: [R] Why does the order of terms in a formula translate into different models/ model matrices?

2012-01-27 Thread cberry
Alexandra writes: > Dear all, > > I have encountered some strange things when creating lm objects in R: model > depends on the order of the terms specified in a formula. > Let us consider the following simple example: > >> dat <- expand.grid(A = factor(c("a1", "a2")), > +B =

[R] repeat function for entire list of matrices

2012-01-27 Thread pabears
hi all. perhaps someone can help me with subsetting here i'm trying to use the nested() function in the bipartite package. my problem is that i have a list of 10,000 matrices and i want the output to be a vector of the nested() function on each of the 10,000 matrices (so i can use th

[R] how to install the fbasics and use stablefit function?

2012-01-27 Thread zoezoe
hi, I have installed the fbasics package. And when I wrote "?stablefit", it says 'No documentation for 'stablefit' in specified packages and libraries'. When I tried "??stablefit", it showed that the stablefit is in fBasics::Distributionfit. However, I have installed the fbasics package. I don't kn

Re: [R] Grabbing Column and Row titles

2012-01-27 Thread chuck.01
I would suggest reading some introductory manuals on R; specifically (with regards to your question) how to construct a function. Basically, "dat" is a variable input to the function. Everywhere you see "dat" is replaced by whatever you put in; for example: f(x) puts the data.frame "x" in for "

[R] Generating repeated network measures in R

2012-01-27 Thread Jeremy Goss
I am working on directed network data of the following form: Origin farm Destination farm Year Farm 1 -> Farm 21999 Farm 1 -> Farm 31999 Farm 3 -> Farm 22000 Farm 1 -> Farm 2

Re: [R] Why does the order of terms in a formula translate into different models/ model matrices?

2012-01-27 Thread Mark Difford
On Jan 27, 2012; 6:29pm Ben Bolker wrote: > My best (not very well-informed) guess is that there is something going > on with automatic dropping of terms > that appear to be aliased?? and that this test is (perhaps > unintentionally) order-dependent. Looks to me like Ben is close to the mark h

Re: [R] tm package: handling contractions

2012-01-27 Thread Milan Bouchet-Valat
Le vendredi 27 janvier 2012 à 09:50 -0500, Michael Friendly a écrit : > I tried making a wordcloud of Obama's State of the Union address using > the tm package to process the text > > sotu <- scan(file="c:/R/data/sotu2012.txt", what="character") > sotu <- tolower(sotu) > corp <-Corpus(VectorSourc

Re: [R] Grabbing Column and Row titles

2012-01-27 Thread chuck.01
This is true with regard to all things you don't understand in R... use question mark (?) # this will show you the manual, or help page ?dput also, make sure you hit the "quote" button when you reply on this forum so that people know what you are replying to. I used dput() to create the follo

[R] date arithmetic discrepancy

2012-01-27 Thread Ty Canuck
What accounts for the different result? > as.numeric(as.POSIXct("2012-01-13 08:10:00") - as.POSIXct("2012-01-13 00:00:00") , units='secs') [1] 29400 > trunc(as.numeric(as.POSIXct("2012-01-13 08:10:00") - as.POSIXct("2012-01-13 00:00:00") , units='secs') ) [1] 29399 [[alternative HTML ver

[R] R-HELP

2012-01-27 Thread Christopher Kelvin
please help; I want to know how to generate an interval-censored data of about 20% and a right censored data of about 30%  using the weibull distribution of say, x=rweibull(100,shape=1.2,scale=1.5) [[alternative HTML version deleted]] __ R-help

[R] Sensitivity analysis - looking a tool for epidemiologic research

2012-01-27 Thread Dominic Comtois
Stata users can rely on the very neat Episens package for sensitivity analysis. Briefly, it allows one to specify a diagnostic tool's sensitivity and specificity and take those into account when estimating a risk ratio, for instance. A full description of the package is available at

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread David Winsemius
Shouldn't this be similar (if not equivalent ) to examining the leverage or influence of z1 and z{n+1} in the full model of Y ~ beta*Z[1:(n+1)] ? -- David On Jan 27, 2012, at 7:46 PM, Michael wrote: > Yes, these observations are measured at equal-spaces... > > And the "n"-axis is the time

Re: [R] Grabbing Column and Row titles

2012-01-27 Thread Carlos Ortega
Hello, Please check function which(). > > m <- matrix(1:12,3,4) > which(m==5, arr.ind=T) row col [1,] 2 2> which(m==9, arr.ind=T) row col [1,] 3 3 > Regards, Carlos Ortega www.qualityexcellence.es 2012/1/27 chuck.01 > Please use dput() to post your example matrix. > > > > >

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Michael
Yes, these observations are measured at equal-spaces... And the "n"-axis is the time axis... Thank you! On Fri, Jan 27, 2012 at 3:54 PM, David Winsemius wrote: > > On Jan 27, 2012, at 4:10 PM, Michael wrote: > > I changed the notation for data from x to z... >> >> That's it. Should be very clear

Re: [R] merge multiple data frames

2012-01-27 Thread MacQueen, Don
Not tested, but this might be a case for the sqldf package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 1/26/12 9:29 AM, "maxbre" wrote: >This is my reproducible example (three data frames: a, b, c) > >a<-structure

Re: [R] convert sas date format

2012-01-27 Thread MacQueen, Don
Does this do what you want? sasf <- c('31.12.1959','1.1.1960','1.2.1960') dt <- as.Date(sasf, format='%d.%m.%Y') -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 1/27/12 7:45 AM, "Fischer, Felix" wrote: >Hi everybo

Re: [R] calculating distance between latitude and longitude

2012-01-27 Thread MacQueen, Don
Also spDistsN1() and spDists() in package sp, a perhaps more basic starting point for working with spatial data in R. See also the r-sig-geo mailing list, as well as the CRAN spatial task view. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 9455

Re: [R] percentage from density()

2012-01-27 Thread Rolf Turner
On 28/01/12 11:44, Duke wrote: Hi folks, I know that density function will give a estimated density for a give dataset. Now from that I want to have a percentage estimation for a certain range. For examle: > y = density(c(-20,rep(0,98),20)) > plot(y, xlim=c(-4,4)) Now if I want to know the

[R] percentage from density()

2012-01-27 Thread Duke
Hi folks, I know that density function will give a estimated density for a give dataset. Now from that I want to have a percentage estimation for a certain range. For examle: > y = density(c(-20,rep(0,98),20)) > plot(y, xlim=c(-4,4)) Now if I want to know the percentage of data lying in (-20

Re: [R] Subsetting for the ten highest values by group in a dataframe

2012-01-27 Thread Phil Spector
Sam - I think that subset is what's throwing you off here -- you need a function that will simply return the 10 rows of each group with the highest values of x: function(dat)dat[order(dat$x,decreasing=TRUE)[1:10],] Then ddply(df,'z',function(dat)dat[order(dat$x,decreasing=TRUE)[1:10],]) sho

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread David Winsemius
On Jan 27, 2012, at 4:10 PM, Michael wrote: I changed the notation for data from x to z... That's it. Should be very clear now... Thanks! Data: z1, z2, ..., z_{n+1} y1 = z_1,z_2,. z_n y2 = z_2, z_3,. z_{n+1} x1 = 1, ..., n x2 = 1, ..., n y1 = A1+ x1 * B1 + epsilon_1 y2 = A

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Mark Leeds
Hi: I don't think my paper applies because it needs the same y. Also, I don't think I follow what you're doing now ( now you have different y and different x's ? ) so I'd rather not comment but hopefully someone else does understand Good luck. On Fri, Jan 27, 2012 at 4:10 PM, Michael wrote: > I

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Michael
I changed the notation for data from x to z... That's it. Should be very clear now... Thanks! Data: z1, z2, ..., z_{n+1} y1 = z_1,z_2,. z_n y2 = z_2, z_3,. z_{n+1} x1 = 1, ..., n x2 = 1, ..., n y1 = A1+ x1 * B1 + epsilon_1 y2 = A2 + x2 * B2 + epsilon_2 H0: B1 and B2 are stati

Re: [R] How to write the entire session to file?

2012-01-27 Thread Greg Snow
A different approach is to use the etxtStart function in the TeachingDemos package. You need to run this before you start, then it will save everything (commands and output and plots if you tell it to) to a file that can then be post processed to give a file that shows basic coloring (or with o

Re: [R] Placing a Shaded Box on a Plot

2012-01-27 Thread Greg Snow
The locator() function can help you find coordinates of interest on an existing plot. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >

Re: [R] calculating distance between latitude and longitude

2012-01-27 Thread David L Carlson
Look at distm() in package geosphere or geoDist() in package SoDA. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Mark Leeds
now i'm confused because you first use y_1, y_2 and then use y later. I would take a look at that earlier paper i mentioned. I think it's along the lines of what you want. Unfortunately. I don't have a computer copy of it. I got it from a library service where I once worked. mark On Fri, Jan 27,

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Michael
Thanks all. Here are a more clear statement of my question: Data: z1, z2, ..., z_{n+1} y1 = z_1,z_2,. z_n y2 = z_2, z_3,. z_{n+1} x1 = 1, ..., n x2 = 1, ..., n y = A1+ x1 * B1 + epsilon_1 y = A2 + x2 * B2 + epsilon_2 H0: B1 and B2 are statistically significally different...

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Mark Leeds
Hi Richard: I read michael's question as meaning that he says two univariate no intercept regression model where the predictor data is different in each model so that x1 = x_11,x_12,. x_1n x2 = x_21, x_22,. x_2n y = y_1, .y_n y = x1 * B1 + epsilon_1 y = x2 * B2 + epsilon_2 a

Re: [R] Is there a R command for testing the difference of two liear regressions?

2012-01-27 Thread Richard M. Heiberger
It looks like you might be asking for the anova() on two models. M1 <- lm(y ~ x1 + x2 + x3, data=something) M2 <- lm(y ~ x2 + x3, data=something) anova(M1, M2) Please send a reproducible example to the list if more detail is needed. Rich On Thu, Jan 26, 2012 at 11:59 PM, Michael wrote:

[R] Subsetting for the ten highest values by group in a dataframe

2012-01-27 Thread Sam Albers
Hello, I am looking for a way to subset a data frame by choosing the top ten maximum values from that dataframe. As well this occurs within some factor levels. ## I've used plyr here but I'm not married to this approach require(plyr) ## I've created a data.frame with two groups and then a id var

[R] Help to improve bwplot plot (lattice)

2012-01-27 Thread gianni lavaredo
Dear Researchers, I wish to plot mean, standard deviation, and standard error and I am using bwplot(). I have the following problems and sorry if maybe there are simple questions: 1- use color black for standarddevuation line and add horizontal end bar (as the commun graphic in scientific papers)

Re: [R] How to write the entire session to file?

2012-01-27 Thread Richard M. Heiberger
If you save the session into a file with the extension R.out, and then open it in ESS in emacs, you will get the syntax highlighting. On Fri, Jan 27, 2012 at 2:03 PM, Ajay Askoolum wrote: > savehistory writes all the executed lines from the session. > > How can I write everything (executed lines

[R] How to write the entire session to file?

2012-01-27 Thread Ajay Askoolum
savehistory writes all the executed lines from the session. How can I write everything (executed lines and output) from the active session to a file? Using Edit | Select All then Edit Copy, I can copy everything to the clipboard and write the whole thing to a file manually. If I just used the

Re: [R] PosixCT subsecond accuracy

2012-01-27 Thread Curt Seeliger
> From: Hasan Diwan > To: R Project Help > Date: 01/27/2012 10:47 AM > Subject: [R] PosixCT subsecond accuracy > Sent by: r-help-boun...@r-project.org > > The first column is epoch time. I read that POSIXct has support for > this, sort of[1]. So, I tried: > > sensor[,1] <- as.POSIXct(sensor[,1]/

[R] package does not have a NAMESPACE

2012-01-27 Thread Ondřej Mikula
Dear r-helpers, I have a trouble with a package downloaded from sourceforge.net (namely the package 'kopls'). I installed it from the local zip file with the expected result > utils:::menuInstallLocal() package ‘kopls’ successfully unpacked and MD5 sums checked but when I tried to load it I obtain

Re: [R] PosixCT subsecond accuracy

2012-01-27 Thread Hasan Diwan
Never mind... options(digits.sec) is what I needed to set... -- H On 27 January 2012 10:44, Hasan Diwan wrote: > A sample of the data I have is: >> head(sensor) >      logged_on    accx   accy   accz compassx  compassy compassz > gyrox      gyroy      gyroz > 1 1326561428000 -0.4602 0.8346 0.0936

Re: [R] How do I compare 47 GLM models with 1 to 5 interactions and unique combinations?

2012-01-27 Thread Greg Snow
What variables to consider adding and when to stop adding them depends greatly upon what question(s) you are trying to answer and the science behind your data. Are you trying to create a model to predict your outcome for future predictors? How precise of predictions are needed? Are you trying

Re: [R] convert sas date format

2012-01-27 Thread peter dalgaard
On Jan 27, 2012, at 18:58 , David Winsemius wrote: > > On Jan 27, 2012, at 10:45 AM, Fischer, Felix wrote: > >> Hi everybody, >> >> i have a csv-file, containing dates in an akward sas format, where >> 31.12.1559 is -1, 1.1.1960 is 1, 2.1.1960 is 2 and so on (see >> http://www.sfu.ca/sasdoc/

[R] PosixCT subsecond accuracy

2012-01-27 Thread Hasan Diwan
A sample of the data I have is: > head(sensor) logged_onaccx accy accz compassx compassy compassz gyrox gyroy gyroz 1 1326561428000 -0.4602 0.8346 0.0936 0.145508 -0.350586 0.259766 59.617390 28.521740 59.617390 2 1326561428050 -0.4212 1.0452 0.1326 0.219727 -0.321289 0.2

Re: [R] How do I compare 47 GLM models with 1 to 5 interactions and unique combinations?

2012-01-27 Thread Frank Harrell
Ruben you are mistaken on every single point. But I see it's not worth continuing this discussion. Frank Rubén Roa wrote > > -Mensaje original- > De: r-help-bounces@ [mailto:r-help-bounces@] En nombre de Frank Harrell > Enviado el: viernes, 27 de enero de 2012 14:28 > Para: r-help@ > Asu

Re: [R] Confused with Student's sleep data description

2012-01-27 Thread peter dalgaard
On Jan 27, 2012, at 17:18 , R. Michael Weylandt wrote: > It doesn't have anything to do with attach (which is naughty in other ways!) > rather it's the internal representation of categorical variables (R speak: > factors) that store each level as an integer for memory efficiency but print > t

Re: [R] Placing a Shaded Box on a Plot

2012-01-27 Thread Ken
Stephanie Cooke gmail.com> writes: > > Hello, > > I would like to place shaded boxes on different areas of a > phylogenetic tree plot. Since I can not determine how to find axes on > the phylogenetic tree plot I am not able to place the box over certain > areas. Below is example code for the sh

Re: [R] Quality of fit statistics for NLS?

2012-01-27 Thread John C Nash
Peter and Bert have already made some pertinent remarks. This comment is a bit tangential, but in the same flavour. As they note, it is "goodness of fit relative to what?" that is important. As a matter of course when doing nonlinear least squares, I generally compute the quantity [1 - resid

Re: [R] Overimposing one map in ssplot onto another

2012-01-27 Thread Dimitri Liakhovitski
Sorry, I meant to send it to the map R list, but sent it here by mistake. Still, if someone could help, it'd be great! Thank you! On Fri, Jan 27, 2012 at 12:49 PM, Dimitri Liakhovitski wrote: > Hello! > > I have 2 maps - both created in ssplot and both identical in terms of > outline. Is there an

[R] Overimposing one map in ssplot onto another

2012-01-27 Thread Dimitri Liakhovitski
Hello! I have 2 maps - both created in ssplot and both identical in terms of outline. Is there any way to superimpose Map1 (which has black borders between Canadian provinces) onto Map2 (which is also a map of Canada)? Thanks a lot for your hints! Dimitri ### A. Reading in Canada data at the prov

Re: [R] convert sas date format

2012-01-27 Thread David Winsemius
On Jan 27, 2012, at 10:45 AM, Fischer, Felix wrote: Hi everybody, i have a csv-file, containing dates in an akward sas format, where 31.12.1559 is -1, 1.1.1960 is 1, 2.1.1960 is 2 and so on (see http://www.sfu.ca/sasdoc/sashtml/lrcon/zenid-63.htm ). Is there any function in R to convert th

[R] Looping columns/column names

2012-01-27 Thread brannona
Hello, I have a data file that I want to run loess on for 36 columns, divide the original data by the new data, then dividing columns that end in A and B by those that end in C. However, I have something wrong in my first step and am completely stuck on the third. Could someone help me please

[R] Looping column names

2012-01-27 Thread anjulka
Hello, I have a data file that I want to run loess on for 36 columns, divide the original data by the new data, then dividing columns that end in A and B by those that end in C. However, I have something wrong in my first step and am completely stuck on the third. Could someone help me please?

[R] convert sas date format

2012-01-27 Thread Fischer, Felix
Hi everybody, i have a csv-file, containing dates in an akward sas format, where 31.12.1559 is -1, 1.1.1960 is 1, 2.1.1960 is 2 and so on (see http://www.sfu.ca/sasdoc/sashtml/lrcon/zenid-63.htm ). Is there any function in R to convert this into -M-D easily? Best, Felix Dr. rer. nat. Dipl

Re: [R] Calculate a function repeatedly over sections of a ts object

2012-01-27 Thread Jorge Molinos
Thanks a lot for the suggestion. It's just what I was looking for. Jorge From: Gabor Grothendieck [ggrothendi...@gmail.com] Sent: 26 January 2012 21:05 To: R. Michael Weylandt Cc: Jorge Molinos; r-help@R-project.org Subject: Re: [R] Calculate a function

Re: [R] Grabbing Column and Row titles

2012-01-27 Thread chuck.01
Please use dput() to post your example matrix. Rambler1 wrote > > I have run into a problem in my code. What I want to accomplish is this: > I have a user input stock symbols into a list and from there I run the > quantmod package to get historical data. I compute the correlation matrix > and

Re: [R] tm package: handling contractions

2012-01-27 Thread Tyler Rinker
This may not be the answer to your problem but you could gsub out the "pretty apostrophe" for the one tm recognizes.  Also note that this may be due to your use of word which automatically uses the "pretty apostrophe".  The default setting on MS word can be altered to alleviate this.#

Re: [R] help with Box plot

2012-01-27 Thread David Winsemius
On Jan 27, 2012, at 9:47 AM, gianni lavaredo wrote: Dear researchers I wish to plot a box plot without the mean line It's not at the mean. (the black line) and the i wish a full line for the standard deviation And the boxplot whiskers are not at the standard deviations, either. It is a

Re: [R] help with Box plot

2012-01-27 Thread Tal Galili
Hi Gianni, Have a look at this function: http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/gplots/html/plotCI.html And please also read this: http://en.wikipedia.org/wiki/Box_plot So to know how a boxplot is constructed... Contact Details:---

Re: [R] Why does the order of terms in a formula translate into different models/ model matrices?

2012-01-27 Thread Ben Bolker
Alexandra imm.dtu.dk> writes: > > Dear all, > > I have encountered some strange things when creating lm objects in R: model > depends on the order of the terms specified in a formula. > Let us consider the following simple example: > > > dat <- expand.grid(A = factor(c("a1", "a2")), > +

Re: [R] Confused with Student's sleep data description

2012-01-27 Thread R. Michael Weylandt
It doesn't have anything to do with attach (which is naughty in other ways!) rather it's the internal representation of categorical variables (R speak: factors) that store each level as an integer for memory efficiency but print things with string levels so they look nice to the user. You'll

[R] Help boxplot to add mean, standard error and/or stadard deviation

2012-01-27 Thread gianni lavaredo
Dear researchers I wish to plot a box plot without the mean line (the black line) and plot only the mean (red square). Futhermore, is it possible to add standard error and/or stadard deviation? This is an example mytest <- c(2.1,2.6,2.7,3.2,4.1,4.3,5.2,5.1,4.8,1.8,1.4,2.5,2.7,3.1,2.6,2.8) boxplo

Re: [R] lattice panels with grouped extra data as text?

2012-01-27 Thread Rainer Hurling
On 26.01.2012 17:33 (UTC+1), Rainer Hurling wrote: I have a problem with including extra data in a lattice graphic. I am trying to put some calculated values in an extra column of a boxplot. A minimal example should show what I am trying to do: foo <- data.frame( Treatment=rnorm(1:12,2), Varian

Re: [R] R-help

2012-01-27 Thread Gabor Grothendieck
On Fri, Jan 27, 2012 at 9:49 AM, R. Michael Weylandt wrote: > Another way, which I believe will be a little more memory efficient > and time inefficient, though that might vary by machine, would be to > use replicate: > > library(MASS) > set.seed(123) > m <- replicate(1000, coef(fitdistr(rweibull(

Re: [R] null distribution of binom.test p values

2012-01-27 Thread Chris Wallace
Greg, Thomas, thank you dot the detailed and lucid replies. I understand now. I am doing multiple tests and wanted to present an overview of results using pp plots, which were looking very underdispersed. Now I understand why, I think I can generate a "correct" expected distribution which s

Re: [R] merge multiple data frames

2012-01-27 Thread R. Michael Weylandt
Oh, sorry -- I assumed that was intentional since my code passed the identical() test with what you said you wanted. Perhaps this gets what you meant you wanted instead (though the treatment of the names is far from elegant) mergeAll <- function(..., by = "date", all = TRUE) { dotArgs <- list(.

[R] Error in JAGS, cannot monitor z

2012-01-27 Thread alon.benari
Hello. I am running a state space model (the example from Marc kery's Bayesian population analysis using WinBUGS ) The code runs fine for the examle as shown in the book. However I played around and changed the nodes monitored to the latent variable z I get the following error- even though it

[R] tm package: handling contractions

2012-01-27 Thread Michael Friendly
I tried making a wordcloud of Obama's State of the Union address using the tm package to process the text sotu <- scan(file="c:/R/data/sotu2012.txt", what="character") sotu <- tolower(sotu) corp <-Corpus(VectorSource(paste(sotu, collapse=" "))) corp <- tm_map(corp, removePunctuation) corp <- tm

[R] Why does the order of terms in a formula translate into different models/ model matrices?

2012-01-27 Thread Alexandra
Dear all, I have encountered some strange things when creating lm objects in R: model depends on the order of the terms specified in a formula. Let us consider the following simple example: > dat <- expand.grid(A = factor(c("a1", "a2")), +B = factor(paste("b", 1:4, sep="")),

[R] calculating distance between latitude and longitude

2012-01-27 Thread uday
I have some satellite data which contains latitude and longitude information . >From this data I would like to calculate distance between first location (scalar latitude and longitude) and all other (vectors latitude and longitude) How I should solve this problem ? -- View this message in

[R] sorting data according to different boundaries

2012-01-27 Thread SophiePlum
I have 1 data frame "Data" with my main data points (red points: latitude, longitude and other biological parameters) and 3 other data frames for each blue line "front_x" (latitude, longitude). I need to sort the data (red points) according to these lines of points, so one file for each 4 differen

Re: [R] R-help

2012-01-27 Thread R. Michael Weylandt
Another way, which I believe will be a little more memory efficient and time inefficient, though that might vary by machine, would be to use replicate: library(MASS) set.seed(123) m <- replicate(1000, coef(fitdistr(rweibull(50, 0.8, 2), "weibull"))) summary(t(m)) # Need to transpose here (or you c

[R] help with Box plot

2012-01-27 Thread gianni lavaredo
Dear researchers I wish to plot a box plot without the mean line (the black line) and the i wish a full line for the standard deviation This is an example mytest <- c(2.1,2.6,2.7,3.2,4.1,4.3,5.2,5.1,4.8,1.8,1.4,2.5,2.7,3.1,2.6,2.8) boxplot(mytest) really thanks Gianni [[alternative H

[R] Horizontal stacked 100% bars with ggplot2

2012-01-27 Thread Mario Giesel
Hello, R friends, I'm trying to crack this nut: Example Data. pet    gender dog    male dog    female dog    male cat    female cat    female cat    male Plot Task. Horizontal 100% bars where y axis shows gender factor (male vs. female) and x axis shows percentage of kind of pets (dog vs. c

Re: [R] extracting from data.frames for survival analysis

2012-01-27 Thread Terry Therneau
--- begin included message --- ... I am trying to perform survival analysis but continually get errors when extracting from this data.frame: attempt 1: > X <- Surv(B27.vec$AgeOn,B27.vec$UV) > survdiff(X,rho=0,data=uvf) Error in x$terms : $ operator is invalid for atomic vectors ... - end

Re: [R] 3-parametric Weibull regression

2012-01-27 Thread Terry Therneau
--- begin included message --- Hello, I'm quite new to R and want to make a Weibull-regression with the survival package. I know how to build my "Surv"-object and how to make a standard-weibull regression with "survreg". However, I want to fit a translated or 3-parametric weibull dist to account

Re: [R] figure margins too large; was: (no subject)

2012-01-27 Thread Uwe Ligges
1. Use a sensible subject line 2. "Figure margins too large" means there is no space in the device to plot the data, the margins take (almost) all the space already. Uwe Ligges On 26.01.2012 17:59, R. Michael Weylandt wrote: I usually get that error when I'm replotting on a window/device th

Re: [R] How do I compare 47 GLM models with 1 to 5 interactions and unique combinations?

2012-01-27 Thread Rubén Roa
-Mensaje original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de Frank Harrell Enviado el: viernes, 27 de enero de 2012 14:28 Para: r-help@r-project.org Asunto: Re: [R] How do I compare 47 GLM models with 1 to 5 interactions and unique combinations?

Re: [R] R-help

2012-01-27 Thread Gabor Grothendieck
On Fri, Jan 27, 2012 at 6:35 AM, Christopher Kelvin wrote: > Hello, > How can i do simulation with a weibull distribution after i have generated > data with the distribution, > for example; if i generate x=rweibull(50,shape=0.8,scale=2) and i want to > simulate this data 1000 times so that i can

Re: [R] How do I compare 47 GLM models with 1 to 5 interactions and unique combinations?

2012-01-27 Thread Frank Harrell
Ruben, I'm not sure you are understanding the ramifications of what Bert said. In addition you are making several assumptions implicitly: 1. model selection is needed (vs. fitting the full model and using shrinkage) 2. model selection works in the absence of shrinkage 3. model selection can find

Re: [R] pls. help -Logisitic Regression-Urgent

2012-01-27 Thread Michael Griffiths
Hi, I would suggest starting with a look at frequently asked questions, and also ?glm. To get you started this is what you're looking for: glm.mod1<-glm(formula, family=binomial("logit"),data=file) Good luck Mike On Fri, Jan 27, 2012 at 1:17 PM, Frank Harrell wrote: > How many statistics cour

Re: [R] pls. help -Logisitic Regression-Urgent

2012-01-27 Thread Frank Harrell
How many statistics courses have you taken? Frank pnandak wrote > > I have a data set of 8000 records and 124 variables. > To find the Whether that a person who opened the mail will redeem the > Offer (Dependent variable is 0 or 1) > So need to model Logistic Regression. > > My question here is

[R] data format for ordination

2012-01-27 Thread Cathy Fiedler
Hello, I want to do an unconstrained ordination to look at my plant community data but don't know how to account for the fact I have multiple visits per site. Do I need to look at each month separately? My data set is of 30 field sites that I visited 5 times in the year and the abundance of each

Re: [R] cryptic error message: "Error in embed(y, lag) : wrong embedding dimension"

2012-01-27 Thread kingsly
According to the source code of embed function, it will stop work if dimention is <1 or >n . Part of the embed source code is mention below for your reference. if ((dimension < 1) | (dimension > n)) stop ("wrong embedding dimension") I have also give the link of the source file of emb

[R] pls. help -Logisitic Regression-Urgent

2012-01-27 Thread pnandak
I have a data set of 8000 records and 124 variables. To find the Whether that a person who opened the mail will redeem the Offer (Dependent variable is 0 or 1) So need to model Logistic Regression. My question here is - i have 124 variables(mix of categorical and continuous) how would i select(R c

[R] Confused with Student's sleep data description

2012-01-27 Thread Олег Девіняк
I am confused whether Student's sleep data "show the effect of two soporific drugs" or Control against Treatment (one drug). The reason is the next: > require(stats) > data(sleep) > attach(sleep) > extra[group==1] numeric(0) > group [1] Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Ctl Trt Trt Trt Trt Trt T

[R] Bivariate Partial Dependence Plots in Random Forests

2012-01-27 Thread Lucie Bland
Hello, I was wondering if anyone knew of an R function/R code to plot bivariate (3 dimensional) partial dependence plots in random forests (randomForest package). It is apparently possible using the rgl package (http://esapubs.org/archive/ecol/E088/173/appendix-C.htm) or there may be a mor

[R] Your message to mingw awaits moderator approval

2012-01-27 Thread mingw-bounces
Your mail to 'mingw' with the subject test Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification of the moderator's decis

Re: [R] generate a random number with rexp ?

2012-01-27 Thread Ted Harding
On 27-Jan-2012 Adel ESSAFI wrote: > dear list > > I use runif to generate a ramdom number between min and max > > runif(n, min=0, max=1) > > however , the syntaxe of rexp does not allow that > > rexp(n, rate = 1) > > and it generate a number with the corresponding rate. > The question is: how

  1   2   >