Re: [R] position of the end of a text file

2011-10-16 Thread Henri-Paul Indiogine
I think I have it and my apologies for spamming the list. I should not work this late on Sunday :-) I think that it should be as.integer(regexpr("$$", my.text.vector) 2011/10/16 Henri-Paul Indiogine : > > I tried the following > > as.integer(regexpr("??", my.text.vector) -- Henri-Paul Indio

[R] position of the end of a text file

2011-10-16 Thread Henri-Paul Indiogine
Hi! I need to find the position of the last character (could be empty space) of a vector of text files (my.text.vector) that I have read into R. I tried Google, but all I have found needs a pattern. I tried the following as.integer(regexpr("??", my.text.vector) but it returns 1 or even the cor

Re: [R] right justify right-axis tick values in lattice

2011-10-16 Thread baptiste auguie
Hi, You could also pad the text labels with phantom 0s, ghostrighter <- function(x, ...){ n <- sapply(x, nchar) nmax <- max(n) padaone <- function(ii){ si <- paste(rep("0", length= nmax - n[ii]), collapse="") as.expression(bquote(phantom(.(si)) * .(x[ii]) )) } sapply(seq_along(

Re: [R] How to plot CI's (llim ulim) on ecodist mgram

2011-10-16 Thread Weidong Gu
It is good to provide the code but please make sure it is reproducible? e.g. XZ is not defined in mgram(XY,XZ)? Weidong Gu On Sun, Oct 16, 2011 at 7:10 PM, Nevil Amos wrote: > I would like to put confidence intervals on a mantel corellogram > they are already calculated in the pmgram object but

Re: [R] Opening Screen

2011-10-16 Thread Rolf Turner
On 17/10/11 12:12, Matt Curcio wrote: Greetings All, What is the procedure to make the open screen for R silent. I would to have my opening screen in Ubuntu 10.04 linux open to an empty terminal. Instead of the list of licenses and version of R that is being run. By the way, I am using RStudio

[R] simultaneously maximizing two independent log likelihood functions using mle2

2011-10-16 Thread Adam Zeilinger
Hello, I have a log likelihood function that I was able to optimize using mle2. I have two years of the data used to fit the function and I would like to fit both years simultaneously to test if the model parameter estimates differ between years, using likelihood ratio tests and AIC. Can an

[R] mgp and axis title positions

2011-10-16 Thread Benjamin Cheah
Hi all, I consider myself a somewhat experienced user of R, but have struggled with this for a while now. to the point where I just end up pulling the entire graph together in powerpoint and fixing it up from there. How does one adjust the horizontal/vertical positions of axis titles? I've tried

Re: [R] Suppressing the Intercept in lm() when using a dataframe for the model

2011-10-16 Thread Cliff Clive
Well don't I feel silly now. Thanks for the help! -- View this message in context: http://r.789695.n4.nabble.com/Suppressing-the-Intercept-in-lm-when-using-a-dataframe-for-the-model-tp3910327p3910443.html Sent from the R help mailing list archive at Nabble.com. _

[R] Beginner's question about ptrend. What package to use in R and a general explanation of the statistics.

2011-10-16 Thread Bob Briggs
Hello I'm wanting to understand more about ptrend (a statistical explanation via an internet website if possible) and also to know what package in R would produce a ptrend. Appreciate any help I can get on this as I'm trying to read and understand an epidemiological paper and data and rep

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of David Winsemius > Sent: Sunday, October 16, 2011 1:59 PM > To: Jeff Newmiller > Cc: r-help@r-project.org; syrvn > Subject: Re: [R] Which function to use: grep, replace, substr etc

Re: [R] ecdf

2011-10-16 Thread Dennis Murphy
Thanks for the clarification. I stand corrected. Dennis On Sun, Oct 16, 2011 at 5:48 PM, gj wrote: > David is right. I am looking for the ecfd for fs$numstudents. The > other column is just an id. > > I guess I don't know how to read the R documentation when it comes to > functions. > > looking

Re: [R] ecdf

2011-10-16 Thread Sarah Goslee
Hi, On Sun, Oct 16, 2011 at 8:48 PM, gj wrote: > David is right. I am looking for the ecfd for fs$numstudents. The > other column is just an id. > > I guess I don't know how to read the R documentation when it comes to > functions. > > looking at the documentation, i now notice that it says "Com

Re: [R] ecdf

2011-10-16 Thread gj
David is right. I am looking for the ecfd for fs$numstudents. The other column is just an id. I guess I don't know how to read the R documentation when it comes to functions. looking at the documentation, i now notice that it says "Compute an empirical cummulative distribution function and not a

[R] What does \Sexpr[results=rd]{} exactly mean in Rd?

2011-10-16 Thread Yihui Xie
Hi, I have spent a few hours on the R-exts manual and the documentation of parse_Rd() (as well as the PDF document in the references), but I still have not figured out what results=rd means. I thought I could use an R code fragment to create an Rd fragment dynamically. Here is an example, in which

Re: [R] glmmadmb help

2011-10-16 Thread Ben Bolker
[cc'ed back to r-help] I've started to take a look, and there's nothing immediately obvious about the problem with the fit (the warnings and errors are about a "non-positive-definite Hessian", which usually means an overfitted/poorly identified model) -- still working on whether there's a way to

Re: [R] right justify right-axis tick values in lattice

2011-10-16 Thread Paul Murrell
Hi On 16/10/2011 6:17 p.m., Richard M. Heiberger wrote: How can I right justify the right-axis tick values? They appear in the example below as left-justified. I have tried several different ways and all fail in different ways. The example below creates the right axis tick value with no attem

Re: [R] How to plot CI's (llim ulim) on ecodist mgram

2011-10-16 Thread Sarah Goslee
Hi, The x value you want is lag from my.mgram$mgram You can use lines() to add them to the plot. Sarah On Sun, Oct 16, 2011 at 7:10 PM, Nevil Amos wrote: > I would like to put confidence intervals on a mantel corellogram > they are already calculated in the pmgram object but I am unsure how I

[R] How to plot CI's (llim ulim) on ecodist mgram

2011-10-16 Thread Nevil Amos
I would like to put confidence intervals on a mantel corellogram they are already calculated in the pmgram object but I am unsure how I get the x value in order to plot them? package(ecodist) X<-1:100 Y<-rnorm(1:100) Z<-rnorm(1:100) XY<-dist(data.frame(X,Y)) YX<-dist(data.frame(Y,X)) my.mgram<-

Re: [R] Suppressing the Intercept in lm() when using a dataframe for the model

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 3:55 PM, Cliff Clive wrote: It's easy to run a linear regression on a simple model without an intercept just by doing this: lm(y ~ x1 + x2 -1) Is there a similar trick to suppress the intercept when your model is in a large dataframe and you don't want to write out th

Re: [R] position of first and last axis tick

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 3:08 PM, Jonas Stein wrote: Hi, how can i set the position of the first and last tick to the borderline of a plot? The plot should look like this one made in Gnuplot [1]. Gnu-R adds some space between the ticks and the end of plot. do you mean like this? plot(rnorm(25),

Re: [R] ecdf

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 3:53 PM, Dennis Murphy wrote: Hi: I don't understand what you're attempting to do. Wouldn't courseid be a categorical variable with a numeric label? If that is so, why are you trying to compute an EDF? An EDF computes cumulative relative frequency of a random variable, whic

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 1:32 PM, Jeff Newmiller wrote: Note that "male" comes before "female" in your data frame. --- Jeff Newmiller The . . Go Live... syrvn wrote: Hi, thanks for the tip! I do it as follows now

Re: [R] Suppressing the Intercept in lm() when using a dataframe for the model

2011-10-16 Thread Joshua Wiley
On Sun, Oct 16, 2011 at 12:55 PM, Cliff Clive wrote: > It's easy to run a linear regression on a simple model without an intercept > just by doing this: > > lm(y ~ x1 + x2 -1) > > > Is there a similar trick to suppress the intercept when your model is in a > large dataframe and you don't want to w

[R] position of first and last axis tick

2011-10-16 Thread Jonas Stein
Hi, how can i set the position of the first and last tick to the borderline of a plot? The plot should look like this one made in Gnuplot [1]. Gnu-R adds some space between the ticks and the end of plot. [1] http://commons.wikimedia.org/wiki/File:Atmospheric_radiocarbon_1954-1993.svg kind rega

[R] Suppressing the Intercept in lm() when using a dataframe for the model

2011-10-16 Thread Cliff Clive
It's easy to run a linear regression on a simple model without an intercept just by doing this: lm(y ~ x1 + x2 -1) Is there a similar trick to suppress the intercept when your model is in a large dataframe and you don't want to write out the names of individual columns? -- View this message in

Re: [R] Help in kmeans

2011-10-16 Thread Christoph Molnar
Hi, no, don't use kmeans with factors. The kmeans algorithm does, besides other things, calculate the mean of the k clusters. But you don't get a useful mean from factors, because the internally used integers are arbitrary. In this case its 1,2 and 3. But it could be 42, 7 and 10 as well, whi

Re: [R] Editor for RD file?

2011-10-16 Thread Joshua Wiley
On Sun, Oct 16, 2011 at 7:20 AM, Duncan Murdoch wrote: > On 11-10-16 8:57 AM, Bogaso Christofer wrote: >> >> Dear all, can somebody please update me on what could be the best editor >> to >> write and edit the RD files? I need to something with syntax highlighter, >> auto-completion etc (like Note

Re: [R] ecdf

2011-10-16 Thread Dennis Murphy
Hi: I don't understand what you're attempting to do. Wouldn't courseid be a categorical variable with a numeric label? If that is so, why are you trying to compute an EDF? An EDF computes cumulative relative frequency of a random variable, which by definition is numeric. If we were talking about E

Re: [R] question: ragged array

2011-10-16 Thread Dennis Murphy
Hi: Try this: ratok <- data.frame(Id = rep(1:3, 3:1), value = c(2, 3, 4, 2, 1, 5)) aggregate(value ~ Id, data = ratok, FUN = mean) Id value 1 1 3.0 2 2 1.5 3 3 5.0 aggregate() returns a data frame with the Id variable and mean(value). HTH, Dennis On Sun, Oct 16, 2011 at 6:53 AM, Hel

Re: [R] Help in kmeans

2011-10-16 Thread raji sankaran
Hi, Thank you .. The information was very helpful. Yes.It was meant to be centers=3.Even with that , kmeans gives error if we give the index of Species columns. So, *is it ok to use kmeans for String data by using cbind*.But, kmeans*works even if we give a column which contains distinct String

Re: [R] Help in kmeans

2011-10-16 Thread Christoph Molnar
Hi, I suspect your column Species is of class "factor" (as it is in R's built in iris dataset). This means that in your case Species is an integer vector with the additional information of the levels names. kmeans is internally calling as.matrix(), which creates a character matrix of your datafram

Re: [R] need help in pausing a script

2011-10-16 Thread Patrick Connolly
On Sun, 16-Oct-2011 at 09:08AM -0700, M3Mph15 wrote: |> Hey, I'm new to R. I wrote a script for doing several statistic tests and |> plot. is there any way to add a kind of pause function which halts script |> execution until a key is pressed. Please help fast if you can ?browser |> |> -- |> V

Re: [R] need help in pausing a script

2011-10-16 Thread Joshua Wiley
In addition to Michael's suggestion, if what you want to pause is the creation of graphs, set: par(ask = TRUE) see ?par for details. It makes it so that user input is required between each graph plotting. Cheers, Josh On Sun, Oct 16, 2011 at 9:08 AM, M3Mph15 wrote: > Hey, I'm new to R. I wro

Re: [R] need help in pausing a script

2011-10-16 Thread R. Michael Weylandt
Perhaps something like this (stolen from the demo() code): readline("\nType \t to start : ") # If you don't want the auto-print "" and are running it interactively, a call to invisible() might help. Michael Weylandt On Sun, Oct 16, 2011 at 12:08 PM, M3Mph15 wrote: > Hey, I'm new to R. I wrote

Re: [R] right justify right-axis tick values in lattice

2011-10-16 Thread Richard M. Heiberger
Perfect. Thank you David. Since I almost always want right-axis numeric ticks to be right justified, I will include this function as part of the next version of the HH package (any day now), listing you as author. Would you consider sending this as a proposed patch to lattice? As a patch it migh

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread Jeff Newmiller
Note that "male" comes before "female" in your data frame. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /S

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread syrvn
Hi, thanks for the tip! I do it as follows now but I still have a problem I do not understand: abbrvs <- data.frame(c("peter", "name", "male", "female"), c("P", "N", "m", "f")) colnames(abbrvs) <- c("pattern", "replac

[R] need help in pausing a script

2011-10-16 Thread M3Mph15
Hey, I'm new to R. I wrote a script for doing several statistic tests and plot. is there any way to add a kind of pause function which halts script execution until a key is pressed. Please help fast if you can -- View this message in context: http://r.789695.n4.nabble.com/need-help-in-pausing-a-s

Re: [R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 12:35 PM, syrvn wrote: Hello, I have a simple question but I don't know which method is best to use for my problem. I have the following strings: str1 <- "My_name_is_peter" str2 <- "what_is_your_surname_peter" I would like to apply predefined abbreviations for peter=p

[R] Which function to use: grep, replace, substr etc.?

2011-10-16 Thread syrvn
Hello, I have a simple question but I don't know which method is best to use for my problem. I have the following strings: str1 <- "My_name_is_peter" str2 <- "what_is_your_surname_peter" I would like to apply predefined abbreviations for peter=p and name=n to both strings so that the new string

Re: [R] nlrq {quantreg}

2011-10-16 Thread Roger Koenker
The model _is_ linear in parameters, after the log transformation of the response, so you don't need nlrq. If you really want something like: y = exp(a + b x) + u then you need to make a token effort to look at the documentation. Here is another example: x <- exp(rnorm(50)) y

Re: [R] ecdf

2011-10-16 Thread David Winsemius
On Oct 16, 2011, at 11:31 AM, gj wrote: Hi, Newbie here. I read the R for Beginners but i still don't get this. I have the following data (this is just an example) in a CSV file: courseid numstudents 101 209 141 13 246 140 263

[R] ecdf

2011-10-16 Thread gj
Hi, Newbie here. I read the R for Beginners but i still don't get this. I have the following data (this is just an example) in a CSV file: courseid numstudents 101 209 141 13 246 140 263 8 321 10 361

Re: [R] glmmadmb help

2011-10-16 Thread Ben Bolker
chchjames windowslive.com> writes: > > Thanks for the reply Ben. I tried it with verbose=TRUE, and got about 7 pages > of a word doc as an output, that ended with the error "Error in > glmmadmb(stainp ~ beetle.ev + Caged * Section/SegmentT + (1 | : > The function maximizer failed". > > I am

Re: [R] Help in kmeans

2011-10-16 Thread Raji
Hi All, For executing kmeans for Iris, we found that there were 2 different ways. dataFrame <- read.csv("c:/Iris.csv",header=T) 1. kmeans_model<-kmeans(dataFrame[1:5],size=3) *This gave an error as it had Species which is a String column as one of the inputs* 2.attach(dataFrame) kmeans_mo

[R] background normalization in rma() in the affy package

2011-10-16 Thread Brian Tsai
Hi, i was looking into the documentation for the rma() function in affy() package, and was trying to figure out how exactly the background normalization is done. I read all three papers cited in the rma() documentation, but the most detailed explanation i could find was in Irizary et al., 2003, w

Re: [R] question: ragged array

2011-10-16 Thread Weidong Gu
if you set parameter simplify=TRUE, it returns a vector of the ragged mean. In your case, mean_rating <- tapply(ratok$value, ratok$project_id , mean,simplify = TRUE) df<-data.frame(ID=dimnames(mean_rating)[[1]], mean=mean_rating) Weidong Gu On Sun, Oct 16, 2011 at 9:53 AM, Helene Schreyer wrot

Re: [R] Editor for RD file?

2011-10-16 Thread Duncan Murdoch
On 11-10-16 8:57 AM, Bogaso Christofer wrote: Dear all, can somebody please update me on what could be the best editor to write and edit the RD files? I need to something with syntax highlighter, auto-completion etc (like Notepad++ for R etc.). Currently I am using plain Notepad however expect so

Re: [R] grouped lattice plot with overall regression line

2011-10-16 Thread Bert Gunter
As usual, try reading the Help files! ?panel.lmline -- Bert On Sun, Oct 16, 2011 at 6:50 AM, Weidong Gu wrote: > If you want to draw the global regression line in each panel, you can try > > xyplot(T~A|speaker,data=spk0,layout=c(4,5),type='p',groups=fns), > panel=function(x,y,...){ > panel.xy

[R] question: ragged array

2011-10-16 Thread Helene Schreyer
Hello, I have a big problem which I’m just not able to solve. I created the following mean value from the following dataset structure: Id |value 1 | 2 1 | 3 1 | 4 2 | 2 2 | 1 3 | 5 4 | 3 etc.|etc. with the command: mean_rating <- tapply(ratok$value, ratok$project_id , mean

Re: [R] grouped lattice plot with overall regression line

2011-10-16 Thread Weidong Gu
If you want to draw the global regression line in each panel, you can try xyplot(T~A|speaker,data=spk0,layout=c(4,5),type='p',groups=fns), panel=function(x,y,...){ panel.xyplot(x,y,...) panel.abline(lm(y~x,data=spk0))}) Weidong Gu 2011/10/16 조혜선 : > I'd like to draw a lattice plot with groups.

Re: [R] Use of ICA for sound

2011-10-16 Thread Simon Urbanek
On Oct 16, 2011, at 1:44 AM, Noah Silverman wrote: > Hi, > > I'm looking at the "cocktail party" classic problem. > > I can see how to use ICA to separate the components. But, How do I then > create new wav files of the separated sounds so that they can be played? > FWIW you can play sounds

[R] Editor for RD file?

2011-10-16 Thread Bogaso Christofer
Dear all, can somebody please update me on what could be the best editor to write and edit the RD files? I need to something with syntax highlighter, auto-completion etc (like Notepad++ for R etc.). Currently I am using plain Notepad however expect something which could be more professional. T

Re: [R] multicore combn

2011-10-16 Thread Søren Højsgaard
Just thought I'd let you know the following: In the gRbase package there is a function called combnPrim which does the same as combn but it is implemented in C - and is quite a bit faster than combn(). Regards Søren Fra: r-help-boun...@r-project.org [r-

Re: [R] Use of ICA for sound

2011-10-16 Thread Uwe Ligges
On 16.10.2011 07:44, Noah Silverman wrote: Hi, I'm looking at the "cocktail party" classic problem. I can see how to use ICA to separate the components. But, How do I then create new wav files of the separated sounds so that they can be played? Others suggested tuneR already for a former

Re: [R] Custom Sort Character and Numeric

2011-10-16 Thread jim holtman
Here is another solution that gets the order you posted: > myArray <- c('AFP9','AFR9','TLQP7','AFS9','AFR8','AFP8','AFS7','TLQS8') > # create a sort key > key <- sub("^(.*)(.)(.)$", "\\3\\2\\1", myArray) > key [1] "9PAF" "9RAF" "7PTLQ" "9SAF" "8RAF" "8PAF" "7SAF" "8STLQ" > # sort, but don't

Re: [R] Custom Sort Character and Numeric

2011-10-16 Thread jim holtman
Try this, but I get a different order especially based on the last digit > myArray <- c('AFP9','AFR9','TLQP7','AFS9','AFR8','AFP8','AFS7','TLQS8') > # create a sort key > key <- sub("^(.*)(.)(.)$", "\\3\\2\\1", myArray) > key [1] "9PAF" "9RAF" "7PTLQ" "9SAF" "8RAF" "8PAF" "7SAF" "8STLQ" > #

Re: [R] two-sided p-value?

2011-10-16 Thread Uwe Ligges
On 16.10.2011 13:08, Laura wrote: Dear all, I am a little bit confused because of the returned p-value by summary.lm and also summary.rq I thought if the pvalue is<= 0.05 the difference is significant. But the R help says it is a two-sided pvalue. So does that mean the pvalue has to be <= 0.0

Re: [R] Drop ALL Levels of a Data Frame Object

2011-10-16 Thread swonder03
No worries for the brevity. That worked exactly like I wanted. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Drop-ALL-Levels-of-a-Data-Frame-Object-tp3903788p3909062.html Sent from the R help mailing list archive at Nabble.com. ___

[R] two-sided p-value?

2011-10-16 Thread Laura
Dear all, I am a little bit confused because of the returned p-value by summary.lm and also summary.rq I thought if the pvalue is <= 0.05 the difference is significant. But the R help says it is a two-sided pvalue. So does that mean the pvalue has to be <= 0.025 and >= 0.975? Best, Laura -- Vi

[R] Custom Sort Character and Numeric

2011-10-16 Thread swonder03
I"m trying to do a custom sort in this order: 1) Numeric digit furthest right; 2) Alphabetical second furthest to the right; 3) Alphabetical the rest of the string beginning with the first character; The example code I'm using is an array that follows: /myArray <- c('AFP9','AFR9','TLQP7','AFS9

Re: [R] function for handling time

2011-10-16 Thread Alaios
You are too good! Thanks a lot ! Have a nice weekend B.R Alexs From: Jim Lemon Cc: "R-help@r-project.org" Sent: Sunday, October 16, 2011 9:10 AM Subject: Re: [R] function for handling time On 10/16/2011 04:13 AM, Alaios wrote: > Dear all > I have the followi

Re: [R] write.csv naming file after function argument

2011-10-16 Thread Kristian Lind
Thank you for your help. It works now. 2011/10/13 Jean V Adams > > Kristian Lind wrote on 10/13/2011 04:52:16 AM: > > > > > Dear R-users, > > > > I'm writing a program that constructs a dataset. I wish to save the > dataset > > to a file. > > > > Here's a very simple example of what I'm trying t

[R] nlrq {quantreg}

2011-10-16 Thread Julia Lira
Dear all, I sent an email on Friday asking about nlrq {quantreg}, but I haven't received any answer. I need to estimate the quantile regression estimators of a model as: y = exp(b0+x'b1+u). The model is nonlinear in parameters, although I can linearise it by using log.When I write: fitnl <- nlr

[R] grouped lattice plot with overall regression line

2011-10-16 Thread 조혜선
I'd like to draw a lattice plot with groups. The groups (the grouping condition, fns) are successfully marked with separate symbols, using the following code: xyplot(T~A|speaker,groups=fns,pch=1:3,key=list(space="right",points=list(pch=1:3)),type=c("g","p","r")) Here's a hard part. This draws reg

[R] multicore combn

2011-10-16 Thread jebyrnes
This is a 'rather than re-invent the wheel' post. Has anyone out there re-written combn so that it can be parallelized - with multicore, snow, or otherwise? I have a job that requires large numbers of combinations, and rather than get all of the index values, then crank it through mclapply, I was