[R] How could I use a function saved in one file ?

2010-05-03 Thread A-A_lowie li
Dear All: I create a file named :P_Value with only one simple function: P_Value - function( Table ) { S = fisher.test(Table, alternative = two.sided); return(S$p.value); } However, it seems that it's impossible to use this function

Re: [R] percent by subset

2010-05-03 Thread David Freedman
how about: d=data.frame(ht=rnorm(20,60,20),sex=sample(0:1,20,rep=T)); d with(d,by(ht,sex,mean)) with(d,by(ht,sex,function(x)mean(x=60))) hth, david freedman -- View this message in context: http://r.789695.n4.nabble.com/percent-by-subset-tp2123057p2123079.html Sent from the R help mailing

Re: [R] question about 2SLS

2010-05-03 Thread Dipankar Basu
Thanks. Estimation of the same model with the same dataset gives different results when tsls (from package sem) is used as opposed to ivreg() (from package AER); both parameter estimates and standard errors are different. This is intriguing. Can anyone throw some light on this? Is there any

[R] how to find presence of seasonality in time series data without using graphs ?

2010-05-03 Thread vikrant
Dear R users, I have a univariate time series and I want to examine the presence of seasonality in the series without using graphical methods like autocorrelation(acf) as I need to automate it in a function. Is there any other way by which I could find the presence of seasonality and if

Re: [R] How could I use a function saved in one file ?

2010-05-03 Thread Joshua Wiley
Dear Lowie, To use a function in R that you have saved in a file, you need to source it in first (see ?source). Try this, source(file=pathtoyourfile/P_Value.R) #or whatever your file is named exactly Once you do that, you should be able to use your function. If you always want it to load at

Re: [R] adding year information to a scatter plot

2010-05-03 Thread Rubén Roa
-Mensaje original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de Ozan Bakis Enviado el: domingo, 02 de mayo de 2010 21:25 Para: r-help@r-project.org Asunto: [R] adding year information to a scatter plot Hi R users, I would like to add

Re: [R] How could I use a function saved in one file ? [SEC=UNCLASSIFIED]

2010-05-03 Thread Augusto.Sanabria
Lowie, You can save the function in a file called 'P_value.txt' or something like it (I prefer 'P_value.r'). Then you load the function into your R session by Using: Source(P_value.txt,sep=) ). It is better if you keep all your R functions into The same directory, say directory my_rfunc, Then

Re: [R] How could I use a function saved in one file ?

2010-05-03 Thread Bill.Venables
Try using source(P_Value) before anything else. Also, P_Value can be written as a one-liner: P_Value - function(Table) fisher.test(Table)$p.value so you don't really need a separate function at all. Bill Venables CSIRO/CMIS Cleveland Laboratories -Original Message- From:

[R] How to generate Mackey-Glass time series with ddesolve package?

2010-05-03 Thread Mike Beddo
I could use some help generating a time series for the Mackey-Glass equation: dx/dt = 0.2 x(t-tau)/(1 + x(t-tau)^10) - 0.1 x(t) for the case there tau = 17. I tried the ddesolve package but the dde(...) function seems to hang, not producing anything. Can someone show me the R script how to do

Re: [R] rpart, cross-validation errors question

2010-05-03 Thread Uwe Ligges
On 03.05.2010 04:26, Claudia Penaloza wrote: I ran this code (several times) from the Quick-R web page ( http://www.statmethods.net/advstats/cart.html) but my cross-validation errors increase instead of decrease (same thing happens with an unrelated data set). Why does this happen? Since

Re: [R] Problem with vignette compilation during R CMD check

2010-05-03 Thread Uwe Ligges
Move everything in ./inst/doc that is required for the vignette. Best, Uwe Ligges On 03.05.2010 05:00, Sébastien Bihorel wrote: Dear R-users, I am going through the last steps of package prep before submission to CRAN and I have the following problem. My package contains a single vignette

Re: [R] Shell command help

2010-05-03 Thread Uwe Ligges
On 02.05.2010 21:55, galen kaufman wrote: Dear R Community, I am trying to run a command line in R that will open an external program, have it import a specific input file, run the program, then close the program. The command line that I got from the developer of the model to do this looks

Re: [R] Simple loop code

2010-05-03 Thread RCulloch
Thanks David Henrique, I've been using R for over two years and always used cbind or rbind, that was what I was taught by several folk, and on training courses, you learn something new every day! Cheers, Ross -- View this message in context:

[R] Plotting legend outside of multiple panels

2010-05-03 Thread John Poulsen
Hello, I have used layout() to produce to 2 plots on a page, leaving a plotting space above them. I would like Legend, which will actually be a real legend, to be centered above the two graphs. Right now I am only able to position Legend above the second graph that I create... obviously I am

[R] tracing the origin of warning messages

2010-05-03 Thread Thomas Wutzler
Dear R Users, what is the best way to trace the origin of warning messages? If an error occurs I can use traceback() to see where it comes from. I would like to do similar investigation, where a warning message originates from. Is there an option to turn warnings to errors? I tried the

[R] S3 methods with several dots

2010-05-03 Thread Thomas Wutzler
Dear R-users, I am confused about defining S3 methods when objects or methods involve several dots. Here is my problem. Package coda defines the following two generic methods: as.mcmc(x,...) as.mcmc.list(x,...) I want to add an S3 method for the second method for my object of class twDEMC

[R] Odp: What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.05.2010 00:13:06: Dear R list, Our statisticians usually give us results back in a PDF format. I would like to be able to copy and past tables from R output directly into a Microsoft Word table since this will save us tons of time, be more

Re: [R] apply question

2010-05-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 30.04.2010 23:11:54: Hello David, On Apr 30, 2010, at 11:00 PM, David Winsemius wrote: Note: Loops may be just as fast or faster than apply calls. How come!? is this true also for other similar functions: lapply, tapply and sapply? Then

Re: [R] tracing the origin of warning messages

2010-05-03 Thread Uwe Ligges
Use options(warn=2) Uwe Ligges On 03.05.2010 08:55, Thomas Wutzler wrote: Dear R Users, what is the best way to trace the origin of warning messages? If an error occurs I can use traceback() to see where it comes from. I would like to do similar investigation, where a warning message

Re: [R] tracing the origin of warning messages

2010-05-03 Thread Prof Brian Ripley
On Mon, 3 May 2010, Thomas Wutzler wrote: Dear R Users, what is the best way to trace the origin of warning messages? options(warn=2) at least for the first warning. If an error occurs I can use traceback() to see where it comes from. I would like to do similar investigation, where a

Re: [R] Odp: What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Tal Galili
To continue Petr suggestion, a simple variation for this would be to use sink() Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |

Re: [R] Text dependent on a variable in a R function

2010-05-03 Thread Jim Lemon
On 05/02/2010 10:00 PM, Duncan Murdoch wrote: ... I've seen this description a couple of times lately, and I think it's worth pointing out that it's misleading. The deparse(substitute(x)) trick returns the *expression* that was passed to the argument x. Sometimes that's the name of a variable,

Re: [R] Text dependent on a variable in a R function

2010-05-03 Thread Duncan Murdoch
Jim Lemon wrote: On 05/02/2010 10:00 PM, Duncan Murdoch wrote: ... I've seen this description a couple of times lately, and I think it's worth pointing out that it's misleading. The deparse(substitute(x)) trick returns the *expression* that was passed to the argument x. Sometimes that's the

[R] Extract a 'data.frame$column' column name

2010-05-03 Thread adrien Penac
Hello, I can't find how to get de column name from a data.frame dollar reference. To make it simple, I'd like to obtain Bar from a foo$Bar notation. I've tried col.names(foo$Bar), names(foo$Bar) and so on without sucess. Regards Blaise [[alternative HTML version deleted]]

Re: [R] Extract a 'data.frame$column' column name

2010-05-03 Thread Rodrigo Aluizio
Well, it's may not be the best way to do so, but you may use this: colnames(foo[n]) where n is the column number, or the column name inside '' ''. The $ can't be used because it turn the column content into a vector, loosing its properties (e.g.: column and row names). But when you using [],

Re: [R] Extract a 'data.frame$column' column name

2010-05-03 Thread Ted Harding
On 03-May-10 11:09:43, adrien Penac wrote: Hello, I can't find how to get de column name from a data.frame dollar reference. To make it simple, I'd like to obtain Bar from a foo$Bar notation. I've tried col.names(foo$Bar), names(foo$Bar) and so on without sucess. Regards Blaise You

Re: [R] Extract a 'data.frame$column' column name

2010-05-03 Thread Prof Brian Ripley
as.character(quote(foo$Bar)[[3]]) [1] Bar Hint: this is nothing to do with data frames ($ applies to lists). $ is an operator, so foo$Bar is a call. quote() stops it being evaluated, [[3]] selects the third of the elements (which are $, foo, Bar) and as.character turns the name into a

[R] 3D version of triax.plot (package plotrix)

2010-05-03 Thread Gabriele Esposito
Good afternoon, I am looking for a way to do a scatterplot of 4 values summing to 1 inside a 3D symplex, i.e. an equilateral pyramid. With the function triax.plot I can do that with 3 values summing to 1, but I can't find an equivalent with an extra dimension. Thanks to whoever can help me!

[R] Re : Extract a 'data.frame$column' column name

2010-05-03 Thread adrien Penac
Thank a lot for these answers. Some of you wondered why I needed to do that! In fact, I have not so big data.frame whith many columns (98) and many of them are similar (many binary answers, some factor data and a few quantitative datas). As I am a lazy guy, I wanted to do a sort of function

Re: [R] Re : Extract a 'data.frame$column' column name

2010-05-03 Thread Gabor Grothendieck
See the describe functions in these packages: Hmisc pysch prettyR On Mon, May 3, 2010 at 8:12 AM, adrien Penac farfel...@yahoo.fr wrote: Thank a lot for these answers. Some of you wondered why I needed to do that! In fact, I have not so big data.frame whith many columns (98) and many of

Re: [R] Plotting legend outside of multiple panels

2010-05-03 Thread Jim Lemon
On 05/03/2010 05:15 PM, John Poulsen wrote: Hello, I have used layout() to produce to 2 plots on a page, leaving a plotting space above them. I would like Legend, which will actually be a real legend, to be centered above the two graphs. Right now I am only able to position Legend above the

Re: [R] 3D version of triax.plot (package plotrix)

2010-05-03 Thread Jim Lemon
On 05/03/2010 09:43 PM, Gabriele Esposito wrote: Good afternoon, I am looking for a way to do a scatterplot of 4 values summing to 1 inside a 3D symplex, i.e. an equilateral pyramid. With the function triax.plot I can do that with 3 values summing to 1, but I can't find an equivalent with an

[R] Plotting the explanatory against the dependent in a GAM

2010-05-03 Thread Oscar Saenz de Miera
  To whoever it may correspond, My name is Oscar Saenz and I am working on my thesis in Spain. I am using GAMs in R and, now that I have estimated my models, I need to plot the predicted smooth functions against the dependent variable (just as in Carlslaw et al. 2007, fig. 1*). Otherwise,

[R] Multiple methods in models

2010-05-03 Thread Marshall Feldman
Hi, The model specification formula language introduced in Chambers and Hastie potentially handles rather complex models. Typically the user specifies the model and in a separate argument specifies the method. For example, one specifies a general linear model with glm(formula,family). But

[R] question about the degrees of freedom

2010-05-03 Thread serdal ozusaglam
Dear R users, I think i have a simple question which i want to explain by an example; i have several 2-digit industry codes that i want to use for conducting by-industry analysis but i think there is a problem with the degrees of freedom! for example, when i do my analysis without any

Re: [R] Odp: What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Chris Evans
Thanks Tal/Petr, I regularly use the clipboard option but for most of what I do people would prefer to see things in proportional fonts and I'd love to be able to reformat tabulations easily to get nice layouts. Of course, I've got very adept at global search and replace of successive spaces with

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Lanna Jin
Try, unique(dataset[,1:a]), where a is the number of columns that you have. 1:a would apply the unique to all columns. - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2123976.html Sent

[R] getting parts returned by lmer

2010-05-03 Thread John Sorkin
R 2.10.0 windows XP I am trying to get the coefficients returned from lmer. Normally I would use the names function to get the objects returned by the function. This does not work in lmer, but it does for lm: - lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy) names(fm2)

[R] Hierarchical factors

2010-05-03 Thread Marshall Feldman
Hello, Hierarchical factors are a very common data structure. For instance, one might have municipalities within states within countries within continents. Other examples include occupational codes, biological species, software types (R within statistical software within analytical software),

Re: [R] What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Chris Evans
Thanks Tal Thomas, I am now experimenting with both SWord and R2wd and both are certainly a huge step forward for me, tied as I am to Word and the Windoze/M$ world for now. Chris Tal Galili sent the following at 01/05/2010 09:44: Hi all, I forwarded this question to the r-com mailing

[R] Delete rows with duplicate field...

2010-05-03 Thread someone
as a r noob i am having another problem: i have a big dataframe where each row corresponds to one entry and each column is a field... for instance, i have the column ID and time and many more... Id like to get a dataframe where all IDs are just included once (some users with that ID might have

Re: [R] Hierarchical factors

2010-05-03 Thread Ista Zahn
Hi Marshell, What exactly do you mean by handles this kind of data structure? What do you want R to do? Best, Ista On Mon, May 3, 2010 at 9:44 AM, Marshall Feldman ma...@uri.edu wrote: Hello, Hierarchical factors are a very common data structure. For instance, one might have municipalities

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Lanna Jin
Did you try: if x is the data frame, unique(x)? - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2123956.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Lanna Jin
if that doesn't work, maybe also try: if x is your data frame with length a columns, unique(x[,1:a]). - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2123964.html Sent from the R help

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread someone
thanks for your effort. to be more precise: ID , OS, time and many more are the columns. each entry is a row. when I do: x - unique(dataset$ID) It just gives me a list of all IDs (levels). I want to get a dataframe where just one entry (row) for each ID is included... like: userA , Win,

[R] mblm, confint problem

2010-05-03 Thread Kay Cichini
hello, i did median based linear regression and computed conf.intervals for my coefficients. but something must have went wrong as the estimates are out of estimates confidence bounds. does someone know what is the problem here. i get warning messages about wilcox.test is not able to do

Re: [R] getting parts returned by lmer

2010-05-03 Thread David Winsemius
On May 3, 2010, at 9:41 AM, John Sorkin wrote: R 2.10.0 windows XP I am trying to get the coefficients returned from lmer. Normally I would use the names function to get the objects returned by the function. This does not work in lmer, but it does for lm: When you read the help page for

Re: [R] getting parts returned by lmer

2010-05-03 Thread Ista Zahn
Hi John, David's advice is probably sufficient, but I thought I would just add the following example, showing how to find out what extractor functions have been defined for a particular s4 class: class(fm2) #find out the class of fm2 (mer) showMethods(classes=mer) # find out what methods are

Re: [R] question about the degrees of freedom

2010-05-03 Thread Ista Zahn
Hi Serdal, There is a lot of confusion here (how much is yours and how much is mine remains to be seen). See specific comments in line. On Mon, May 3, 2010 at 9:19 AM, serdal ozusaglam saint-fi...@hotmail.com wrote: Dear R users, I think i have a simple question which i want to explain by an

Re: [R] question about the degrees of freedom

2010-05-03 Thread David Winsemius
On May 3, 2010, at 10:38 AM, Ista Zahn wrote: Hi Serdal, There is a lot of confusion here (how much is yours and how much is mine remains to be seen). See specific comments in line. Also inline comments. On Mon, May 3, 2010 at 9:19 AM, serdal ozusaglam saint-fi...@hotmail.com wrote:

[R] MySQL and DATE data type

2010-05-03 Thread BrettGinsburg
Does anyone know how to deal with DATES in MySQL database connections? dbWriteTable converts dates in a data frame to a character. Thanks! -- Dr. Brett Ginsburg Assistant Professor Department of Psychiatry The University of Texas Health Science Center at San Antonio San Antonio, TX 78229

Re: [R] strange error msg from lapply and lm()

2010-05-03 Thread weix1
plus, it took long time to complete this analysis for only 24 records! Although I get the error msg, the result seems to be correct. -- View this message in context: http://r.789695.n4.nabble.com/strange-error-msg-from-lapply-and-lm-tp2124042p2124050.html Sent from the R help mailing list

[R] strange error msg from lapply and lm()

2010-05-03 Thread weix1
I am conducting a very simple t test for two genes using lapply (i try to avoid loop since i will have thousands of genes later on). however, I got strange error msg like the followings. It looks that R is complaining my factor has only one level, which is not the case (I check many times).

Re: [R] Plotting the explanatory against the dependent in a GAM

2010-05-03 Thread Thomas Stewart
See example(gam) particularly plot(gam.object,se=TRUE). On Mon, May 3, 2010 at 5:20 AM, Oscar Saenz de Miera saenz...@yahoo.comwrote: To whoever it may correspond, My name is Oscar Saenz and I am working on my thesis in Spain. I am using GAMs in R and, now that I have estimated my

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread someone
I dont want to apply the unique for all columns but just the ID column. -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2124011.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Lanna Jin
names() - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2124036.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread someone
could you please elaborate a little more on that? -- View this message in context: http://r.789695.n4.nabble.com/Delete-rows-with-duplicate-field-tp2123939p2124055.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Hierarchical factors

2010-05-03 Thread Marshall Feldman
Thanks for getting back so quickly Ista, I was actually casting about for any examples of R software that deals with this kind of structure. But your question is a good one. Here are a few things I'd like to be able to do: * Store data in R at the finest level of detail but easily refer to

Re: [R] question about the degrees of freedom‏

2010-05-03 Thread serdal ozusaglam
Thank you for your advice, ill try to be more explicit now, i wasnt in the first mail because i thought it is a simple question to answer, so; i have a panel data which contains 48858 observations during 3 year therefore, there are 146574 observations in total, i have 22 different industries

Re: [R] question about the degrees of freedom‏

2010-05-03 Thread serdal ozusaglam
Thank you for your advice, ill try to be more explicit now, i wasnt in the first mail because i thought it is a simple question to answer, so; i have a panel data which contains 48858 observations during 3 year therefore, there are 146574 observations in total, i have 22 different

Re: [R] What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Frank E Harrell Jr
On 05/03/2010 08:47 AM, Chris Evans wrote: Thanks Tal Thomas, I am now experimenting with both SWord and R2wd and both are certainly a huge step forward for me, tied as I am to Word and the Windoze/M$ world for now. Chris Note that many of the general solutions offered produce documents

Re: [R] question about the degrees of freedom

2010-05-03 Thread serdal ozusaglam
Hi Serdal, There is a lot of confusion here (how much is yours and how much is mine remains to be seen). See specific comments in line. Also inline comments. On Mon, May 3, 2010 at 9:19 AM, serdal ozusaglam saint-fi...@hotmail.com wrote: Dear R users, I think i have a simple

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Dennis Murphy
Hi: Here are three solutions; since this question comes up fairly often, you can find other solutions in the R-help archives. (1) Use functions from base R: split the data frame by ID, extract the first record from each split and slurp them together with rbind(): do.call(rbind,

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread Jorge Ivan Velez
How about yourdata[ !duplicated(yourdata$ID), ] ? See ?duplicated for more information. HTH, Jorge On Mon, May 3, 2010 at 9:04 AM, someone wrote: as a r noob i am having another problem: i have a big dataframe where each row corresponds to one entry and each column is a field... for

[R] how to rewrite this for loops in matrix form without loop

2010-05-03 Thread song song
x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0)) ind1=ind[,1] ind2=ind[,2] phi=NULL for (i in 1:length(ind2)){ phi[i]=sum(x0[y0==ind1[i]])/ind2[i] } [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Run na.approx on dataset with some blank columns

2010-05-03 Thread Abiel X Reinhart
I am trying to run na.approx on a zoo object in which some of the columns contain nothing by NA values. When I do this I get the following error: Error in approx(x[!na], y[!na], xout, ...) : need at least two non-NA values to interpolate Is there a way I can use na.approx with my dataset so

Re: [R] question about the degrees of freedom

2010-05-03 Thread David Winsemius
On May 3, 2010, at 11:43 AM, serdal ozusaglam wrote: Hi Serdal, There is a lot of confusion here (how much is yours and how much is mine remains to be seen). See specific comments in line. Also inline comments. On Mon, May 3, 2010 at 9:19 AM, serdal ozusaglam saint-fi...@hotmail.com

[R] Highlight Points in a Plot

2010-05-03 Thread SamT
Hi, I have plotted a cdf using the ecdf function with plot(). I want to highlight/identify points on the same plot. Also, because this is a cdf I am not sure of the y coords for the point, otherwise I thought of using highlight in the NCStats package. Thanks -- View this message in

Re: [R] Delete rows with duplicate field...

2010-05-03 Thread David Winsemius
On May 3, 2010, at 9:59 AM, someone wrote: I dont want to apply the unique for all columns but just the ID column. dataset[ !duplicated(dataset$ID), ] -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list

Re: [R] Hierarchical factors

2010-05-03 Thread Ista Zahn
Hi Marshall, I'm not aware of any packages that implement these features as you described them. But most of the tasks are already fairly easy in R -- see below. On Mon, May 3, 2010 at 11:18 AM, Marshall Feldman ma...@uri.edu wrote: Thanks for getting back so quickly Ista, I was actually

Re: [R] Run na.approx on dataset with some blank columns

2010-05-03 Thread Gabor Grothendieck
Here is a workaround: library(zoo) # test data z - zoo(cbind(1:5, NA, c(1:3, NA, 5), NA)) ix - colSums(!is.na(z)) 0 z[, ix] - na.approx(z[, ix]) On Mon, May 3, 2010 at 12:41 PM, Abiel X Reinhart abiel.x.reinh...@jpmchase.com wrote: I am trying to run na.approx on a zoo object in which some

Re: [R] how to rewrite this for loops in matrix form without loop

2010-05-03 Thread Dennis Murphy
as.vector(do.call(c, lapply(split(x0, y0), mean))) Test with data generated according to your code: phi=NULL for (i in 1:length(ind2)){ + phi[i]=sum(x0[y0==ind1[i]])/ind2[i] + } phi [1] -0.18922774 0.36333115 -0.04295032 -0.13892563 -0.03968301 0.33326034 [7] 0.28649576 -0.03786830

Re: [R] Highlight Points in a Plot

2010-05-03 Thread David Winsemius
On May 3, 2010, at 12:28 PM, SamT wrote: Hi, I have plotted a cdf using the ecdf function with plot(). Code would make this concrete. I want to highlight/identify points on the same plot. Also, because this is a cdf I am not sure of the y coords for the point, otherwise I thought of

Re: [R] how to rewrite this for loops in matrix form without loop

2010-05-03 Thread Henrique Dallazuanna
Try this: rowsum(x0, y0)[,1]/table(y0) On Mon, May 3, 2010 at 2:11 PM, song song rprojecth...@gmail.com wrote: x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0)) ind1=ind[,1] ind2=ind[,2] phi=NULL for (i in 1:length(ind2)){ phi[i]=sum(x0[y0==ind1[i]])/ind2[i] }

Re: [R] how to rewrite this for loops in matrix form without loop

2010-05-03 Thread Henrique Dallazuanna
Or better: tapply(x0, y0, mean) On Mon, May 3, 2010 at 2:35 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: rowsum(x0, y0)[,1]/table(y0) On Mon, May 3, 2010 at 2:11 PM, song song rprojecth...@gmail.com wrote: x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0))

Re: [R] how to rewrite this for loops in matrix form without loop

2010-05-03 Thread Joshua Wiley
I believe you are trying to find the mean of x0 for each level (group) of y0. try this: by(x0, y0, mean) or if you want a vector (e.g., to merge into a matrix) c(by(x0, y0, mean)) Best regards, Josh On Mon, May 3, 2010 at 10:11 AM, song song rprojecth...@gmail.com wrote: x0=rnorm(100)

[R] Comparing the correlations coefficient of two (very) dependent samples

2010-05-03 Thread Tal Galili
Hello all, I believe this can be done using bootstrap, but I am wondering if there is some other way that might be used to tackle this. #Let's say I have two pairs of samples: set.seed(100) s1 - rnorm(100) s2 - s1 + rnorm(100) x1 - s1[1:99] y1 - s2[1:99] x2 - x1 y2 - s2[2:100] #And both yield

Re: [R] Find solution for an error in the condition of if

2010-05-03 Thread anderson nuel
I will sur that problem is coming from the first part of the test. data[pa,k] is a vector because pa is a vector. Coud you help me to solve this error. Best Regards 2010/4/30 Duncan Murdoch murdoch.dun...@gmail.com On 30/04/2010 4:19 AM, anderson nuel wrote: Dear r-help, Could you

[R] how to name the column after converting a vector to a data frame

2010-05-03 Thread wei x1
hell all: I have a vector as follows: head(res) 1007_s_at.value 1053_at.value117_at.value121_at.value 1255_g_at.value 0.225801033 0.009747404 0.709517954 0.008825740 0.496859178 1294_at.value 0.005091231 after I convert the res into a data frame I got

[R] rcolorbrewer

2010-05-03 Thread Steve Hempell
Can you reverse the color scheme order in rcolorbrewer. If so, how? [[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

Re: [R] rcolorbrewer

2010-05-03 Thread milton ruser
?rev On Mon, May 3, 2010 at 4:06 PM, Steve Hempell sthemp...@gmail.com wrote: Can you reverse the color scheme order in rcolorbrewer. If so, how? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] how to name the column after converting a vector to a data frame

2010-05-03 Thread Barry Rowlingson
On Mon, May 3, 2010 at 7:21 PM, wei x1 weix1_2...@hotmail.com wrote: hell all: I have a vector as follows: head(res) 1007_s_at.value   1053_at.value    117_at.value    121_at.value 1255_g_at.value    0.225801033     0.009747404     0.709517954     0.008825740     0.496859178  

Re: [R] Find solution for an error in the condition of if

2010-05-03 Thread Duncan Murdoch
On 03/05/2010 2:43 PM, anderson nuel wrote: I will sur that problem is coming from the first part of the test. data[pa,k] is a vector because pa is a vector. Coud you help me to solve this error. If you want to test that all elements match, you should use all(data[pa, k] == df[, j])

Re: [R] Highlight Points in a Plot

2010-05-03 Thread SamT
For simplicity we'll assume my code looks as follows plot(ecdf(1:1000)) which produces a diagonal line. Ideally, I'd like to highlight or label in a different color certain X values (say 50,55,60,65) Is there a function which will allow me to do this? -- View this message in context:

Re: [R] Highlight Points in a Plot

2010-05-03 Thread David Winsemius
On May 3, 2010, at 3:16 PM, SamT wrote: For simplicity we'll assume my code looks as follows plot(ecdf(1:1000)) which produces a diagonal line. Ideally, I'd like to highlight or label in a different color certain X values (say 50,55,60,65) Is there a function which will allow me to do

Re: [R] Errors when trying to open odfWeave documents

2010-05-03 Thread Max Kuhn
I tried with this: sessionInfo() R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages:

Re: [R] Highlight Points in a Plot

2010-05-03 Thread SamT
Thanks David, the text() worked for me. I wasnt able to correctly use plot with points and the ecdf function. David Winsemius wrote: Yes, ecdf() which returns a function points(c(50,55,60,65), ecdf(1:1000)( c(50,55,60,65) ), col=c(red, green, yellow, blue) ) Draws colored

[R] LMER docuentation could be improved WAS: Re: getting parts returned by lmer

2010-05-03 Thread John Sorkin
Many thanks to both David and Ista. I think that my question regarding extracting items returned from lmer points out a weakness of R, viz. less than perfect documentation. I know that R is written by volunteers, all of whom I cherish, yet having to ask the listserve for a question as basic as

[R] Analyzing non-numerical data

2010-05-03 Thread Ottar Kvindesland
After having read through some literature on R, I am happy with collecting it, and visualizing numbers. Unfortunately I do find it hard to compare and visualize string data. The data is from a LimeSurvey with lots of YES/NO or multi-choice questions (check-boxes) Among the check-boxes there a

[R] extended Kalman filter for survival data

2010-05-03 Thread christophe dutang
Dear all, I'm looking for an implementation of the generalized extended Kalman filter for survival data, presented in this article Fahrmeir (1994) - 'dynamic modelling for discrete time survival data'. The same author also publish a Bayesian version of the algorithm 'dynamic discrete-time

[R] Adding a header after the file is written

2010-05-03 Thread steven mosher
The situation arises where I open a file to write a data.frame to it. with write.table. multiple lines are written to the file and the file is kept in Append=TRUE mode. If one sets the col.names to the names of the variables being written, you have output that looks like this... name1 name2

Re: [R] LMER docuentation could be improved WAS: Re: getting parts returned by lmer

2010-05-03 Thread Ista Zahn
Dear John, The R documentation is of course not perfect, but it is (in my estimation) quite good. See more specific responses below, keeping in mind that I'm actually pretty ignorant of this things myslef. On Mon, May 3, 2010 at 4:44 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: Many thanks

Re: [R] / Operator not meaningful for factors

2010-05-03 Thread vincent.deluard
Hi there, This will sound very stupid because I just started using R but I see you had similar problems. I just loaded a very large dataset (2950*6602) from csv into R. The format is ticker=row, date=column. Every time I want to compute basic operations, R returns In Ops.factor: not meaningful

Re: [R] Adding a header after the file is written

2010-05-03 Thread Ted Harding
On 03-May-10 21:19:34, steven mosher wrote: The situation arises where I open a file to write a data.frame to it. with write.table. multiple lines are written to the file and the file is kept in Append=TRUE mode. If one sets the col.names to the names of the variables being written,

Re: [R] Adding a header after the file is written

2010-05-03 Thread Ista Zahn
Hi Steve, I think you just need to set col.names = FALSE (instead of col.names =NULL) on subsequent writes. -Ista On Mon, May 3, 2010 at 5:19 PM, steven mosher mosherste...@gmail.com wrote: The situation arises where I open a file to write a data.frame to it. with write.table. multiple lines

Re: [R] / Operator not meaningful for factors

2010-05-03 Thread David Winsemius
On May 3, 2010, at 6:22 PM, vincent.deluard wrote: Hi there, This will sound very stupid because I just started using R but I see you had similar problems. I just loaded a very large dataset (2950*6602) from csv into R. The format is ticker=row, date=column. Not a particularly

[R] Labels in GLMNET

2010-05-03 Thread RichS
In the ESL(2) (by F-H-T), they have labels on their Lasso graphs (specifically for the South African Heart Disease data). So my question is, how do I label each variable in a similar way on my graph. The following code should produce a plot with 9 enumerated variables: library(glmnet)

[R] Help needed with legend

2010-05-03 Thread Nish
Hello, I am new to R and need some help with the legend. How can I add a legend for two variables (in two columns) each having multiple values to be explained in the legend. For example: Var 1 Var 2 symbol - Higher symbol - Higher symbol - Avgsymbol

[R] advice?

2010-05-03 Thread Carson Baughman
All- Thank you in advance for any help you might be able to lend. Here is my issue. I am trying to open a fairly large .dat file. The file originally was downloaded as a GZ file but I unzipped it (with 7-zip) into it's current 1.86 gig .dat format. I know that the data is just a plain

[R] Controlling panel.text

2010-05-03 Thread Santosh
Dear R gurus, A re-post due to suggestions from moderators. Thanks to tips from Gabor and Felix, I was able to make some progress.. How do I control the position of panel.text? I would like the text appear at a specific position (say, top right corner) inside a panel. Below is the sample

  1   2   >