Re: [R] How to load load multiple text files and order by id

2011-03-05 Thread Dennis Murphy
Hi: This is basically Scott's idea with a few added details. Let's assume your files have similar names - e.g., they differ only by number. The example below creates ten files of similar structure to yours. There are then two paths one can follow: (1) put all the files into a specific directory,

Re: [R] How to load load multiple text files and order by id

2011-03-05 Thread Scott Chamberlain
Hi Richard, This may be a bit ugly, but it should work if you have all your files in a folder you are calling from. Use dir() within the lapply call in combination with read.table as the function require(plyr) setwd("/Mac/R_stuff/files") # where your files are in this directory, and no files y

Re: [R] Can body() return a function's body intact, in order, and as characters ready for editing?

2011-03-05 Thread Gabor Grothendieck
On Sat, Mar 5, 2011 at 8:20 PM, Kingsley G. Morse Jr. wrote: > Is my understanding correct that the body() > function currently can't return a function's body > intact, in order, and as characters ready for > editing? > > My testing and reading of body()'s help indicate > that it can not. > > Here

Re: [R] How to load load multiple text files and order by id

2011-03-05 Thread Kingsley G. Morse Jr.
Hi Richard, If you haven't tried it already, maybe you could read the files into separate data frames with read.table(), and then combine them with merge(). Type ?merge to learn more. Good luck, Kingsley On 03/05/11 18:39, Richard Green wrote: > Hello R users, > I am fairly new to R and w

Re: [R] displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-05 Thread Jorge Ivan Velez
Hi Umesh, You can try something along the lines of: d <- dataf[dataf$p < 0.05, ] # p < 0.05 with(d, plot(xvar, p, col = 'white')) with(d, text(xvar, p, name, cex = .7)) HTH, Jorge On Sat, Mar 5, 2011 at 12:29 PM, Umesh Rosyara <> wrote: > Dear R users, > > Here is my problem: > > # example

Re: [R] testing power of correlation

2011-03-05 Thread Jeremy Miles
Can you clarify what you mean? The strength of the correlation is the correlation. One (somewhat) useful definition is Cohen's, who said 0.1 is small, 0.3 is medium and 0.5 is large. Or do you (as your subject says) want to get the power for a correlation? This is a different thing. Jeremy O

Re: [R] testing power of correlation

2011-03-05 Thread Jorge Ivan Velez
Hi Anna, Take a look at ?cor ?cor.test and http://www.statmethods.net/stats/power.html HTH, Jorge On Sat, Mar 5, 2011 at 3:02 PM, Anna Gretschel <> wrote: > Dear List, > > does anyone know how I can test the strength of a correlation? > > Cheers, Anna > >

[R] Can body() return a function's body intact, in order, and as characters ready for editing?

2011-03-05 Thread Kingsley G. Morse Jr.
Is my understanding correct that the body() function currently can't return a function's body intact, in order, and as characters ready for editing? My testing and reading of body()'s help indicate that it can not. Here's what I'm seeing. Consider pasting 1+ and a function containing

[R] displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-05 Thread Umesh Rosyara
Dear R users, Here is my problem: # example data name <- c(paste ("M", 1:1000, sep = "")) xvar <- seq(1, 1, 10) set.seed(134) p <- rnorm(1000, 0.15,0.05) dataf <- data.frame(name,xvar, p) plot (dataf$xvar,p) abline(h=0.05) # I can know which observation number is less than 0.05 which (da

[R] Creating a code

2011-03-05 Thread tsvi sabo
Hi AllI am a begginer in R, i m writing a procedure for my project,it is actually a procedure that interact with the user and asks him\her to enter data and choose variables and so and so...instead of writing a very long procedural code that it is impossible to followi would like to make it modu

Re: [R] Coefficient of Determination for nonlinear function

2011-03-05 Thread Uwe Wolfram
Dear Bert, dear Andy, thanks for your answers! I am quite aware that I do not fit a linear model, so r^2 in Pearson's sens is indeed meaningless. Instead, I am "fitting" an equation - or rather using an optimisation - were the experimentally derived point cloud (x1, x2, x3) should deliver somethin

[R] please help ! label selected data points in huge number of data points potentially as high as 50, 000 !

2011-03-05 Thread Umesh Rosyara
Dear All I am reposting because I my problem is real issue and I have been working on this. I know this might be simple to those who know it ! Anyway I need help ! Let me clear my point. I have huge number of datapoints plotted using either base plot function or xyplot in lattice (I have prefe

Re: [R] Change panel background color in spplot()

2011-03-05 Thread Mark Difford
Marcel, Here is one way: spplot(meuse.grid, zcol = "part.a", par.settings = list(panel.background=list(col="grey"))) ## trellis.par.get() trellis.par.get()$panel.background Regards, Mark. > On 03/05/2011 01:06 PM, Marcel J. wrote: >> Hi! >> >> How does one change the background color of th

[R] testing power of correlation

2011-03-05 Thread Anna Gretschel
Dear List, does anyone know how I can test the strength of a correlation? Cheers, Anna __ 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 p

[R] How to load load multiple text files and order by id

2011-03-05 Thread Richard Green
Hello R users, I am fairly new to R and was hoping you could point me in the right direction I have a set of text files (36). Each file has only two columns (id and count) , I am trying to figure out a way to load all the files together and then have them ordered by id into a matrix data frame. For

Re: [R] Ordering several histograms

2011-03-05 Thread djbirdnerd
not yet, but i have only just started programming in r... I don't know if i will able to... -- View this message in context: http://r.789695.n4.nabble.com/Ordering-several-histograms-tp382p3336869.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] xts POSIXct index format

2011-03-05 Thread David Winsemius
On Mar 5, 2011, at 11:28 AM, Joshua Ulrich wrote: Hi Chris, Perhaps something like this? require(xts) ds <- options(digits.secs=6) # so we can see sub-seconds x <- xts(1:10, as.POSIXct("2011-01-21") + c(1,1,1,2:8)/1e3) x indexFormat(x) <- "%H:%M:%OS3" x Joshua; Does your reading of help(i

Re: [R] xts POSIXct index format

2011-03-05 Thread rivercode
Thank you for your help. indexFormat(x) solved the problem nicely. > head(a) 2011-03-04 09:30:00.0 22.10 2011-03-04 09:30:00.1 22.09 2011-03-04 09:30:00.2 22.10 2011-03-04 09:30:00.3 22.09 2011-03-04 09:30:00.4 22.10 2011-03-04 09:30:00.5 22.09 > indexFormat(a) <- "%H:%M:%OS3" > head(a)

[R] file mode lost in file.copy()?

2011-03-05 Thread Yihui Xie
Hi, Recently I noticed file.copy() would discard the file mode information. Is this the expected behaviour or a bug for file.copy()? > file.create('testfile') [1] TRUE > file.info('testfile') size isdir mode mtime ctime testfile0 FALSE 644 2011-03-05 17:

Re: [R] Grouping data in ranges in table

2011-03-05 Thread Jorge Ivan Velez
Hi Jason, Something along the lines of with(Orange, table(cut(age, breaks = c(118, 664, 1004, 1372, 1582, Inf)), cut(circumference, breaks = c(30, 58, 62, 115, 145, 179, 214 should get you started. HTH, Jorge On Sat, Mar 5, 2011 at 5:38 PM, Jason Rupert <> wrote

Re: [R] Grouping data in ranges in table

2011-03-05 Thread Greg Snow
?cut -- 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- > project.org] On Behalf Of Jason Rupert > Sent: Saturday, March 05, 2011 3:38 PM >

Re: [R] get name of script from where the command is invoked

2011-03-05 Thread Duncan Murdoch
On 11-03-05 1:36 PM, Jannis wrote: Dear List members, is it somehow possible to retrieve the name of the file from where some command is invoked in (!) interactive mode? That means that I am running single lines of code within ESS /R-GUI and do NOT use source to execute the whole script. If y

[R] Grouping data in ranges in table

2011-03-05 Thread Jason Rupert
Working with the built in R data set Orange, e.g. with(Orange, table(age, circumference)). How should I go about about grouping the ages and circumferences in the following ranges and having them display as such in a table? age range: 118 - 664 1004 - 1372 1582 circumference range: 30-58 62-

Re: [R] lty=NULL crashing R for x11(type="cairo")

2011-03-05 Thread Martin Maechler
> "IZ" == Ista Zahn > on Sat, 5 Mar 2011 14:07:04 + writes: IZ> I confirm this bug exists and is 100% replicable on R IZ> version 2.12.2 (2011-02-25) Platform: i686-pc-linux-gnu IZ> (32-bit) WHoa... debugging ===> it *is* a bug in R after all : > plot(1); axi

Re: [R] Multi-line input to rsympy

2011-03-05 Thread Gabor Grothendieck
On Fri, Mar 4, 2011 at 6:48 AM, Joanna Lewis wrote: > Dear R users, > > I have been using rsympy to solve a set of simultaneous equations from R. > There are two solutions for the variable I'm interested in, xx[0] and xx[1], > which are in terms of symbols called lam and conc. I'd like to pick out

Re: [R] subsetting data by specified observation number

2011-03-05 Thread Greg Snow
Here is one way: > tmp1 <- data.frame(Species=c('setosa','virginica','versicolor'), + row=c(7,20,18) ) > > tmp.iris <- iris > tmp.iris$row <- ave(iris$Sepal.Length, iris$Species, FUN=seq_along) > > out.iris <- merge(tmp.iris, tmp1, by=c('Species','row')) > > > out.iris Species row Sepal.L

Re: [R] subsetting data by specified observation number

2011-03-05 Thread Linh Tran
Hi, Thank you for the reply. That would only work for the first ID. In addition, the data frame that I'm trying to subset is separate from the data frame that has the position numbers. "failed.3" is the data frame with the position numbers that I would like to keep. "def3" is the data frame that

Re: [R] subsetting data by specified observation number

2011-03-05 Thread Greg Snow
Will failed.3 have each id exactly once? Or could it have multiple lines for a given id? -- 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] retrieve x y coordinates of points in current plot

2011-03-05 Thread Greg Snow
Theoretically possible, but it is going to be easiest to just supply the original data (like you do when you run identify). You can look at the output of the plot2script function in the TeachingDemos package to see the idea. That function creates a script which will recreate the current plot (

Re: [R] subsetting data by specified observation number

2011-03-05 Thread jdnew...@gmail.com
What is wrong with subset( failed.3, position == 2 ) ? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Linh Tran wrote: Hi members, I'd like to thank you guys ahead of time for the help. I'm kind of stuck. I have a data frame with ID and position numbers: 1> head(faile

[R] subsetting data by specified observation number

2011-03-05 Thread Linh Tran
Hi members, I'd like to thank you guys ahead of time for the help. I'm kind of stuck. I have a data frame with ID and position numbers: 1> head(failed.3) id position 1 19972 4 1000RW_M2 15 1006RW_G2 24 1012RW_M3 28 101609172 30 1016RW_M

Re: [R] retrieve x y coordinates of points in current plot

2011-03-05 Thread Jannis
On 03/05/2011 07:25 PM, Greg Snow wrote: It is not completely clear what you are trying to accomplish. Do you want to draw a shape in the plot then identify all the points in that shape? You could use locator (with type='l') to draw a polygon, then there are functions in add on packages (mos

[R] get name of script from where the command is invoked

2011-03-05 Thread Jannis
Dear List members, is it somehow possible to retrieve the name of the file from where some command is invoked in (!) interactive mode? That means that I am running single lines of code within ESS /R-GUI and do NOT use source to execute the whole script. Cheers Jannis _

Re: [R] retrieve x y coordinates of points in current plot

2011-03-05 Thread Greg Snow
It is not completely clear what you are trying to accomplish. Do you want to draw a shape in the plot then identify all the points in that shape? You could use locator (with type='l') to draw a polygon, then there are functions in add on packages (mostly the spatial ones) that will detect whic

Re: [R] How to show non user defined data set such as cu.summary (from rpart)?

2011-03-05 Thread Uwe Ligges
Yes, after you have loaded rpart using library("rpart"), you will find the search() list similar to this one: R> search() [1] ".GlobalEnv""package:rpart" "package:psych" "package:stats" [5] "package:graphics" "package:grDevices" "package:datasets" "package:utils" [9] "package:

Re: [R] Fwd: r.dll

2011-03-05 Thread Uwe Ligges
On 04.03.2011 19:40, wesley mathew wrote: Dear All I downloaded R-2.12.2.tar file, but I could not find R.dll file there. Do u mean the Windows binary distribution is R-2.12.2.tar No, it is the source distribution. 1. Go to CRAN. 2. Click on "Windows" 3. Click on "base" 4. Click on "Previ

Re: [R] PCA - scores

2011-03-05 Thread Uwe Ligges
On 04.03.2011 17:52, Shari Clare wrote: Hi Bill and Josh: When I run any "principal" code with scores=TRUE, I get the following Error: Error in principal (my.data,3,scores=TRUE) : unused argument (scores=TRUE) Thoughts? Your psych version (and probably also your R version) is outdated? Ple

[R] extractModelParameters HELP!!!

2011-03-05 Thread vaibhav dua
Hello Gurus, I'm using one of the function, i.e. extractModelParameters, from the MplusAutomation package to read parameters fromMplus out files into R. I have 360 cells and each cell has several out files (max. 100). I'm extracting the model parameters from each cell and doing subsequent calcu

Re: [R] How to show non user defined data set such as cu.summary (from rpart)?

2011-03-05 Thread Ista Zahn
Hi John, Not sure how to do it with ls(), but easy enough with data(): data(package=library(base)) You'll need to consult both ?data and ?library to see why this works. labrary(base) could just as easily be library(stats) or whatever. Best, Ista On Sat, Mar 5, 2011 at 4:36 PM, John Edwards wro

[R] How to show non user defined data set such as cu.summary (from rpart)?

2011-03-05 Thread John Edwards
Hi All, ls() doesn't show cu.summary. ?ls says "When invoked with no argument at the top level prompt, \u2018ls\u2019 shows what data sets and functions a user has defined." Therefore, the reason ls() doesn't show cu.summary is because cu.summary is from a package but not user defined. Is there a

Re: [R] xts POSIXct index format

2011-03-05 Thread Joshua Ulrich
Hi Chris, Perhaps something like this? require(xts) ds <- options(digits.secs=6) # so we can see sub-seconds x <- xts(1:10, as.POSIXct("2011-01-21") + c(1,1,1,2:8)/1e3) x indexFormat(x) <- "%H:%M:%OS3" x Hope that helps, -- Joshua Ulrich  |  FOSS Trading: www.fosstrading.com On Fri, Mar 4, 20

Re: [R] xts POSIXct index format

2011-03-05 Thread David Winsemius
On Mar 4, 2011, at 6:57 PM, rivercode wrote: Hi, I cannot figure out how to change the index format when displaying POSIXct objects. Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts object. If you are not satisfied with the default format, you have (at leas

Re: [R] R Statistical Package Installation

2011-03-05 Thread Marc Schwartz
On Mar 5, 2011, at 5:56 AM, Nasir Afsar wrote: > Dear R-project team, > I have tried but could not install the R statistical package > (http://cran.ms.unimelb.edu.au/ ) even after the help of my institute's IT > personnel. The setup file could not be downloaded. The latest file > R-2.12.2.tar.

Re: [R] R Statistical Package Installation

2011-03-05 Thread Wincent
I guess your OS is windows. In that case, you need to download the R binaries for windows (e.g. http://ftp.ctex.org/mirrors/CRAN/bin/windows/) rather than the source tar ball. Regards, Ronggui On 5 March 2011 19:56, Nasir Afsar wrote: > Dear R-project team, > I have tried but could not install t

Re: [R] R Statistical Package Installation

2011-03-05 Thread David Winsemius
On Mar 5, 2011, at 6:56 AM, Nasir Afsar wrote: Dear R-project team, I have tried but could not install the R statistical package (http://cran.ms.unimelb.edu.au/ ) even after the help of my institute's IT personnel. The setup file could not be downloaded. The latest file R-2.12.2.tar.gz

Re: [R] subscript out of bounds

2011-03-05 Thread David Winsemius
On Mar 5, 2011, at 7:41 AM, Stat Consult wrote: On Sat, Mar 5, 2011 at 4:08 PM, Stat Consult wrote: Dear ALL I cannot run this line stat.obs <- apply (GS, 2, function(z) Hott2(t(DATA[which(z==1),]), cl)) Error in Hott2 (t(DATA[which(z == 1), ]), cl) : subscript out of bounds I wil

Re: [R] integrate one single variable functions with constant parameters

2011-03-05 Thread santiagorf
I received the solution... Hi: This is what David means: f <- function(x, p) x^p integrate(f, lower = -1, upper = 1, p = 2) 0.667 with absolute error < 7.4e-15 integrate(f, lower = -1, upper = 1, p = 3) 0 with absolute error < 5.6e-15 # this is correct -- View this message

Re: [R] integrate one single variable functions with constant parameters

2011-03-05 Thread santiagorf
If f is a two-parameter function, how can I integrate it with respect to p? -- View this message in context: http://r.789695.n4.nabble.com/integrate-one-single-variable-functions-with-constant-parameters-tp3336066p3336693.html Sent from the R help mailing list archive at Nabble.com.

[R] out of bound

2011-03-05 Thread Stat Consult
Dear ALL I cannot run this line. stat.obs <- apply (GS, 2, function(z) Hott2(t(DATA[which(z==1),]), cl)) Error in Hott2 (t(DATA[which(z == 1), ]), cl) : subscript out of bounds I will be glade if you guide me. *** *GS

[R] subscript out of bounds

2011-03-05 Thread Stat Consult
Dear ALL I cannot run this line stat.obs <- apply (GS, 2, function(z) Hott2(t(DATA[which(z==1),]), cl)) Error in Hott2 (t(DATA[which(z == 1), ]), cl) : subscript out of bounds I will be glade if you guide me. *** *GS

[R] R Statistical Package Installation

2011-03-05 Thread Nasir Afsar
Dear R-project team, I have tried but could not install the R statistical package (http://cran.ms.unimelb.edu.au/ ) even after the help of my institute's IT personnel. The setup file could not be downloaded. The latest file R-2.12.2.tar.gz

Re: [R] subscript out of bounds

2011-03-05 Thread Stat Consult
On Sat, Mar 5, 2011 at 4:08 PM, Stat Consult wrote: > Dear ALL > > I cannot run this line > > stat.obs <- apply (GS, 2, function(z) Hott2(t(DATA[which(z==1),]), cl)) > > Error in Hott2 (t(DATA[which(z == 1), ]), cl) : subscript out of bounds > > I will be glade if you guide me. > > > *

Re: [R] lattice: drawing strips for single-panel plots

2011-03-05 Thread John G. Bullock
The strip argument to panel.xyplot seems to be ignored for single-panel plots. The workaround is to give it a one-level factor: library(lattice) data(Chem97, package = "mlmRev") Chem97$what = as.factor("strip text") densityplot(~ gcsescore|what, data = Chem97) Thank you. That works. Jo

Re: [R] Change panel background color in spplot()

2011-03-05 Thread Marcel J.
Thank you, Jannis! I came as far as that: library(sp) data(meuse.grid) gridded(meuse.grid) = ~x+y spplot(meuse.grid, zcol = "part.a", sp.layout= list("panel.fill", "grey")) but here not only the background is grey. Instead the whole panel turns grey... Help would be appreciated! Thank you

Re: [R] Contingency table in R

2011-03-05 Thread John Kane
Did you get a reply on this? We really need to see your code and some sample data. Have a look at ?dput tko supply some data. At the moment it looks like R is not recognizing the dara set. If ls( libts the dataset, are you using mydara$excat --- On Wed, 3/2/11, Laura Clasemann wrote: > Fr

Re: [R] retrieve x y coordinates of points in current plot

2011-03-05 Thread Jannis
Thanks for your replies, Dieter and Richard. I am aware of these two functions. I wanted, however, to write a similar function to identify by selecting large clouds of points. For this I would need to rertrieve their coordinates after the plot was called and created. As identify() is able to do

Re: [R] Change panel background color in spplot()

2011-03-05 Thread Jannis
I would guess it works the same as for standard trellis graphs. Googleing: trellis R change panel background gives you links to some discussions about these issues. HTH Jannis On 03/05/2011 01:06 PM, Marcel J. wrote: Hi! How does one change the background color of the map-panel in spplot

Re: [R] pvclust crashing R on Ubuntu 10.10

2011-03-05 Thread Ista Zahn
I confirm this bug exists and is 100% replicable on R version 2.12.2 (2011-02-25) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_US.utf8 [7] LC_PAPER=en_US

[R] Change panel background color in spplot()

2011-03-05 Thread Marcel J.
Hi! How does one change the background color of the map-panel in spplot()? Example: library(sp) data(meuse.grid) gridded(meuse.grid) = ~x+y spplot(meuse.grid, "part.a") How would I get another background-color for the map-panel (but not for the whole plot) here? Thank you! Marcel __

Re: [R] generating factors from the edit function

2011-03-05 Thread Dieter Menne
Erin Hodgess-2 wrote: > > Here is a little function that I put together: > >> fact1 > function(x) { > n <- ncol(x) > for(i in 1:n) { > if(mode(x[,i])=="character")x[,i] <- factor(x[,i]) > } > return(x) > } >> > > See http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg22459.html for a m

Re: [R] lattice: drawing strips for single-panel plots

2011-03-05 Thread Dieter Menne
John G. Bullock-2 wrote: > > The strip argument to panel.xyplot seems to be ignored for single-panel > plots. Here is an example: > >data(Chem97, package = "mlmRev") >myStrip <- function(...) { ltext(.5, .5, 'strip text') } >densityplot(~ gcsescore, data = Chem97, strip=myStrip) >