Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-12 Thread peter dalgaard
On May 12, 2012, at 04:40 , Michael wrote: Hi all, Could you please help me? I am trying to understand why this line works: lm1x = lm(y~X-1, tmp) Here it seems that I was combining the design matrix and the data frame... And X below is not a single column, in fact, it's a bunch

[R] Transform Data using Sigmoid Function

2012-05-12 Thread Suhaila Haji Mohd Hussin
Hello. I'm trying to scaling these attribute values using sigmoid and I created a function as followed: mySigmoid -function(){ medGen = read.csv(medB1.csv); data(medGen); medGen.signorm=rangenorm(medGen,method=signorm); op=par(mfrow=c(2,3)) plot(medGen.signorm[,1])par(op)} So

[R] median teat

2012-05-12 Thread Soheila Khodakarim
Dear All Is there any function for median test in R? Best Regards, Soheila [[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] median teat

2012-05-12 Thread Tal Galili
Hi Soheila, There you go: median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(z=m,g)$p.value } group1 - c(2, 2, 5, 5, 4, 3, 1, 5,5,5,5,5) group2 - c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) boxplot(group1, group2) median.test(group2

Re: [R] median teat

2012-05-12 Thread Sarah Goslee
Hi, On May 12, 2012, at 5:23 AM, Soheila Khodakarim lkhodaka...@gmail.com wrote: Dear All Is there any function for median test in R? Of course, and more than one. You might try going to rseek.org and searching for median test as a way to get started. Sarah Best Regards, Soheila

Re: [R] Help with stemDocument

2012-05-12 Thread Milan Bouchet-Valat
Le jeudi 10 mai 2012 à 17:12 -0700, Triss.Ashton a écrit : Alekseiy, I tried your recommendation with several variations. It still does not run. I think the problem has to do with R2.15 and the refreshed TM package. It works here with R 2.15.0 and tm 0.5-7.2 (development version), all other

Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-12 Thread S Ellison
I am trying to understand why this line works: lm1x = lm(y~X-1, tmp) Well, I would not normally define a data frame element as a matrix myself (though I might well define a list element as one). But specifying a matrix as the terms part of an lm is documented in lm's details: If response is

Re: [R] Transform Data using Sigmoid Function

2012-05-12 Thread Suhaila Haji Mohd Hussin
Please nevermind as I have just solved this. Suhaila From: bell_beaut...@hotmail.com To: r-help@r-project.org Date: Sat, 12 May 2012 20:44:16 +1200 Subject: [R] Transform Data using Sigmoid Function Hello. I'm trying to scaling these attribute values using sigmoid and I created a function as

[R] ggplot simple question.

2012-05-12 Thread rmje
I have a matrix like this Name 12 3 45 NM_0010395141.033557047 0.74698795180.90045248870.8613861386 0.7952499048

[R] moving averages on specific interval and merge

2012-05-12 Thread Jim Green
Greetings! I am using quantstrat and xts to do some intraday work and come up with this problem. the xts object temp in the following example is attached as and rda file. head(temp) A.Open A.High A.Low A.Close A.Volume 2012-02-01 08:29:00 42.47 43.76 41.410 43.76

[R] masked by GlobalEnv ???

2012-05-12 Thread Jhope
Hi R Listers, I am trying to upload a data file and I received this message. It seems that I am still able to make graphs and Aeventexhumed still works in the analysis. Can I ignore this message or do I need to do something about this? Jean require(plyr) Loading required package: plyr

Re: [R] access the se of a forecast

2012-05-12 Thread Rui Barradas
Hello, Many people mistake 'summary' for a special kind of print function. At least I did, at first. The fact is that 'summary' does it's own computations and outputs the result of those computations, to be printed by the appropriate print method. Simply put, what you need is summary(fit)$s20

[R] access the se of a forecast

2012-05-12 Thread plocq
Hi everybody, I am currently trying to forecast some double seasonal time series by using the function dshw. I want to access the standard errors to build the confident interval for my forecast. I am using to following code : fit-dshw(eem,period1=7,period2=48,h=48) then by using summary(fit), I

Re: [R] masked by GlobalEnv ???

2012-05-12 Thread R. Michael Weylandt
The right response is not to use attach(). What's going on is that you have objects by those names in your global workspace and in the object you are attaching. Since .GlobalEnv is always (?) first on the search path, you won't be able to see those that you just added unless you remove the ones

Re: [R] masked by GlobalEnv ???

2012-05-12 Thread Martin Maechler
R Michael Weylandt michael.weyla...@gmail.com on Sat, 12 May 2012 09:20:06 -0500 writes: The right response is not to use attach(). What's going on is that you have objects by those names in your global workspace and in the object you are attaching. Since .GlobalEnv is

Re: [R] ggplot simple question.

2012-05-12 Thread John Kane
That does not look like a matrix but a data frame. Do a class(dataname) to check. It is much better to present the data in a useable format. Have a look at ?dput for a way to provide the data. However if we assulme your data is xx, this may do what you want if I understand you correcctly.

Re: [R] ggplot simple question.

2012-05-12 Thread Jeff Newmiller
On Sat, 12 May 2012, rmje wrote: I have a matrix like this Name 12 3 45 NM_0010395141.033557047 0.74698795180.90045248870.8613861386 0.7952499048

Re: [R] Interweaving of two datasets

2012-05-12 Thread John Kane
I'm not sure if this is what you want but try library(reshape2) dat3 - merge(dat1, dat2) xx - melt(dat3, id=c(phone, request)) dcast(dat3 , phone + name + address ~ request ) John Kane Kingston ON Canada -Original Message- From: gloriaal...@yahoo.it Sent: Fri, 11 May 2012

Re: [R] Calculating all possible ratios

2012-05-12 Thread Rui Barradas
Hello, If by all possible gene ratios you mean all pairwise column ratios, try the following. # Make up some data x - matrix(1:24, ncol=6) cmb - combn(ncol(x), 2) r1 - apply(cmb, 2, function(j) x[, j[1]]/x[, j[2]]) r2 - apply(cmb, 2, function(j) x[, j[2]]/x[, j[1]]) cbind(r1, r2) Note that

Re: [R] moving averages on specific interval and merge

2012-05-12 Thread G See
Dear R-help, Please direct answers to this question to the R-sig-finance list copy of this question (http://stat.ethz.ch/pipermail/r-sig-finance/2012q2/010209.html) Thank you, Garrett On Sat, May 12, 2012 at 4:39 AM, Jim Green student.northwest...@gmail.com wrote: Greetings! I am using

[R] range segment exclusion using range endpoints

2012-05-12 Thread Ben quant
Hello, I'm posting this again (with some small edits). I didn't get any replies last time...hoping for some this time. :) Currently I'm only coming up with brute force solutions to this issue (loops). I'm wondering if anyone has a better way to do this. Thank you for your help in advance! The

[R] Subset and order at the same time?

2012-05-12 Thread Noah Silverman
Is there a way to order data and subset it at the same time?? I want to sort all the members of group A by their values in column 3. (I'll then do the same for each subsequent group.) This could be done in a loop building up another vector, but I like to avoid loops in R.

Re: [R] Subset and order at the same time?

2012-05-12 Thread Berend Hasselman
On 12-05-2012, at 20:04, Noah Silverman wrote: Is there a way to order data and subset it at the same time?? I want to sort all the members of group A by their values in column 3. (I'll then do the same for each subsequent group.) This could be done in a loop building up another

Re: [R] range segment exclusion using range endpoints

2012-05-12 Thread jim holtman
Here is an example of how you might do it. It uses a technique of counting how many items are in a queue based on their arrival times; it can be used to also find areas of overlap. Note that it would be best to use a list for the 's' end points # note the next

Re: [R] Subset and order at the same time?

2012-05-12 Thread Noah Silverman
Bernard, Thanks, but I can't take that shortcut. The data is an xts object, and I may not want to order every group. So, I need a way to just order one group at a time. Thoughts? -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building Los Angeles, CA 90095 On May 12,

Re: [R] Subset and order at the same time?

2012-05-12 Thread jim holtman
Just write a function so that you have a one-liner in your script. It will probably be a lot simpler than trying to type some convoluted one-liner. On Sat, May 12, 2012 at 2:58 PM, Noah Silverman noahsilver...@ucla.edu wrote: Bernard, Thanks, but I can't take that shortcut. The data is an

Re: [R] median teat

2012-05-12 Thread Soheila Khodakarim
Thank you so much. Best Regards, Soheila On Sat, May 12, 2012 at 2:45 PM, Tal Galili tal.gal...@gmail.com wrote: Hi Soheila, There you go: median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(z=m,g)$p.value } group1 - c(2, 2,

Re: [R] median teat

2012-05-12 Thread Soheila Khodakarim
Thank you so much. But I can not open this link, rseek.org:( Best Regards, Soheila On Sat, May 12, 2012 at 2:40 PM, Sarah Goslee sarah.gos...@gmail.comwrote: Hi, On May 12, 2012, at 5:23 AM, Soheila Khodakarim lkhodaka...@gmail.com wrote: Dear All Is there any function for median

Re: [R] Subset and order at the same time?

2012-05-12 Thread Neal Fultz
can be done in one line, but it is annoying and ugly, so you probably shouldn't be doing it that way: sleep[sleep$group == 1,] -sleep[sleep$group == 1,][order(sleep[sleep$group == 1,1]),] sleep extra group ID 1 -1.6 1 2 2 -1.2 1 4 3 -0.2 1 3 4 -0.1 1 5 50.0

[R] Plotmath bug or my misunderstanding?

2012-05-12 Thread Bert Gunter
This is a followup to a recent post on using atop() to obtain multiline expressions. My reading of the plotmath docs makes it clear that issuing (in base graphics) the specification par(cex = 2) doubles symbols and regular text in subsequent plotmath expressions. However, it is unclear to me

[R] x axis dates

2012-05-12 Thread pip
The following data spans out to 2012 and when graphing out the data - R defaults dates on x axis only shows the years eg 200520072009 My question is how can I get the graph to show more dates on the axis - eg every qtr or 6 months or every month etc PRODUCT,DATE,AMOUNT_1,AMOUNT_2

Re: [R] access the se of a forecast

2012-05-12 Thread plocq
Thank you very much for your answer. I didn't know this. However, I tried what you suggest and it doesn't work either : - by typing summary(fit)$s20, I get exactly what I had with summary(fit) and - by typing sfit-summary(fit) and then sfit$s20, I get NULL... these facts seem very strange to me.

Re: [R] access the se of a forecast

2012-05-12 Thread Rui Barradas
Hello, You're right, sorry for the misleading (general purpose) information. fit$model$s20 (The object can be inspected with names(fit) and then print each of the components or names(fit$model).) Rui Barradas plocq wrote Thank you very much for your answer. I didn't know this. However, I

Re: [R] Calculating all possible ratios

2012-05-12 Thread genome1976
Thanks so much Rui. I really appreciate all the help. I implemented the code and it ran fine. I was wondering how I could include the probeset ids as probeset1:probeset2 in the final output so that I know which ratios are for which probeset pairs. Thanks so much. Som. Date: Sat, 12 May 2012

Re: [R] access the se of a forecast

2012-05-12 Thread Rui Barradas
What am I thinking about? Objects should be inspected with str(object) R.B. Rui Barradas wrote Hello, You're right, sorry for the misleading (general purpose) information. fit$model$s20 (The object can be inspected with names(fit) and then print each of the components or

Re: [R] access the se of a forecast

2012-05-12 Thread plocq
Thank you very much for all your tips! It works perfectly know and I begin to understand how R is working. I will now see how to construct this confident interval. Have a nice evening! -- View this message in context:

[R] problem with get() inside of lme()

2012-05-12 Thread chuck.01
Hi, In the following lines of code are inside of a function, where TRAIT1 is a function variable calling a column-name inside of the data.frame new3. This works just fine: m2 - lmer(get(TRAIT1) ~ perm.score + (1|site), data=new3) but this will not work, m3 - lme(get(TRAIT1) ~ perm.score ,

[R] categorical analysis - grouping rows

2012-05-12 Thread cassiorx
I apologize up front if this has been covered elsewhere - but I can't find any such question. I have a data set that contains academic data: term (i.e., semester), student id, dept, class, success (1=Y, 0=N) I want to look at dept by term to determine descriptive statistics for success to

Re: [R] problem with get() inside of lme()

2012-05-12 Thread chuck.01
please note that I edited the original message to say: length(with(new3, perm.score))==length(with(new3, get(TRAIT1))) [1] TRUE chuck.01 wrote Hi, The following lines of code are inside of a function, where TRAIT1 is a function variable calling a column-name inside of the

Re: [R] Calculating all possible ratios

2012-05-12 Thread Rui Barradas
Hello, I'm glad it helped. Now to make the result readable. (I had thought of it.) pairwise.ratios - function(x, prefix=probeset, char=:){ n - ncol(x) cn - colnames(x) if(length(cn) == 0){ cn - gsub( , 0, formatC(seq.int(n), width=nchar(n)))

[R] Help with writing data to csv

2012-05-12 Thread DL
I am trying to write data to csv but I am having issues with the separations. Basically I have some results that I get with R that I copied and pasted into word and then saved as .txt I want to write the results to csv because it's easier to make tables in word (all I would have to do is copy

[R] round up/down to nearest hundredth

2012-05-12 Thread chuck.01
Hi, How can I round up and down to the nearest hundredth example: x - 0.18 how do I round down to 0.15? how do I round down to 0.20? -- View this message in context: http://r.789695.n4.nabble.com/round-up-down-to-nearest-hundredth-tp4629451.html Sent from the R help mailing list archive at

Re: [R] range segment exclusion using range endpoints

2012-05-12 Thread William Dunlap
Here is some code that I've been fiddling with for years (since I wanted to provide evidence that our main office needed more modems and wanted to show how often both of them were busy). It does set operations and a bit more on collections of half-open intervals. (Hence it drops zero-length

Re: [R] median teat

2012-05-12 Thread Jeff Newmiller
I can. There are alternatives, though. RSiteSearch(keywords) at the R prompt. Google with the capital letter R in your search. --- Jeff NewmillerThe . . Go Live...

Re: [R] Help with writing data to csv

2012-05-12 Thread R. Michael Weylandt michael.weyla...@gmail.com
By definition a csv is comma-separated so you can't set a separator. The general function which you seem to be seeking is write.table Michael On May 12, 2012, at 3:33 PM, DL chombito...@hotmail.com wrote: I am trying to write data to csv but I am having issues with the separations.

[R] Query regarding date as argument in functions - and about sqldf

2012-05-12 Thread Shivam
Hi, I have a query about sqldf, and dates in general. I couldnt find much on the net or on the forums, hence I am here. Here is the issue: I want to write a function that accepts 3 arguments: date1, date2 and a dataframe, say 'df'. Within the function, I want to populate a temp dataframe which

Re: [R] Plotmath bug or my misunderstanding?

2012-05-12 Thread Peter Ehlers
Hi Bert, I think the 'cex=' argument applies to the outermost 'atop()'. It then applies that size specification to each of the two components of the atop(a,b). If one of the components is itself another atop(a,b), then the individual parts are sized downward to produce the required cex for the

Re: [R] Help with writing data to csv

2012-05-12 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of DL Sent: Saturday, May 12, 2012 1:33 PM To: r-help@r-project.org Subject: [R] Help with writing data to csv I am trying to write data to csv but I am having issues with the

Re: [R] Subset and order at the same time?

2012-05-12 Thread Joshua Wiley
Hi Noah, I think it is hard to say what is best without your real example. Is the goal elegance or speed? I have not tried it, but if you are ordering say 9/10 groups, I would think you are better off calling order once, even though you will not use it for one group. I also think if you are

Re: [R] Query regarding date as argument in functions - and about sqldf

2012-05-12 Thread Gabor Grothendieck
On Sat, May 12, 2012 at 6:18 PM, Shivam shivamsi...@gmail.com wrote: Hi, I have a query about sqldf, and dates in general. I couldnt find much on the net or on the forums, hence I am here. Here is the issue: I want to write a function that accepts 3 arguments: date1, date2 and a dataframe,

Re: [R] problem with get() inside of lme()

2012-05-12 Thread chuck.01
Here is an example: library(nlme) library(lme4) library(MASS) data(petrol) # a variable for one of the columns in petrol Y.VAR - Y # This works: lmer(get(Y.VAR)~EP +(1|No), data=petrol) # This doesn't: lme(get(Y.VAR)~EP, random= ~1|No, data=petrol) # but this does: lme(Y~EP, random= ~1|No,

Re: [R] Calculating all possible ratios

2012-05-12 Thread Rui Barradas
Hello, Nothing wrong with me, maybe your R session has some conflicting objects. Running the function in the previous post on the first 4 rows and first 6 columns of your dataset the result was (copypaste to your session) result - structure(c(8.74714923153198, 1.83094400392095, 9.92065138471113,

Re: [R] Calculating all possible ratios

2012-05-12 Thread genome1976
Hi Rui, Thanks once again. I really appreciate it. I tried using the code with the following dataset: Sample P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 S1 5292.9 605.1 5213.9 1710.6 1407.8 1079.4 1379.6 9321.4 6951 1205.8 S2 104.6 57.129

Re: [R] Help with writing data to csv

2012-05-12 Thread DL
Thank you for replying. The result of the first command was an excel sheet with the data separated by rows but not columns, which is basically what I get when I copy and paste into Excel. I would like to have the information separated by rows and columns so I can just copy and paste it into a

Re: [R] Split the work for many cores

2012-05-12 Thread Norm Matloff
One replier worried about doing multiple operations on the graphics device in parallel. To avoid this, try saving the output of your plot function instead of immediately displaying it (if the function allows this). Then display everything when you're all done. Norm Matloff To: Alaios

Re: [R] Help with writing data to csv

2012-05-12 Thread jim holtman
I have had no problem at all with writing CSV files and copy/pasting the data into WORD. What you really need to show is what is the actual output in the file that you are working with, and then exactly what you are doing with the data in WORD. So I know that it works fine, so it must be pilot

Re: [R] Help with writing data to csv

2012-05-12 Thread David Winsemius
On May 12, 2012, at 7:24 PM, DL wrote: Thank you for replying. The result of the first command was an excel sheet with the data separated by rows but not columns, which is basically what I get when I copy and paste into Excel. I would like to have the information separated by rows and

[R] Help with V function in igraph

2012-05-12 Thread bmccowan
I am using the code below to output some network measures: central_social - data.frame(V(s641_social)$name, indegree_social, outdegree_social, incloseness_social, outcloseness_social, betweenness_social, eigen_social) and I get the following error: Error in Re(z) : non-numeric argument to

Re: [R] Help with writing data to csv

2012-05-12 Thread jim holtman
Take a look at the data in a text file and you will see that it is a CSV file with a single column: 1 ONE.LEVEL.ANALYSIS.WITH.Speaker..random..and.folseg..5.04e.08preseg..3.77e.07position..0.402sylstress..0.93. 2

Re: [R] Calculating all possible ratios

2012-05-12 Thread genome1976
I apologize. You were right. You are a genius! Thanks so much! Best Regards, Som. Date: Sat, 12 May 2012 15:20:52 -0700 From: ml-node+s789695n4629656...@n4.nabble.com To: genome1...@hotmail.com Subject: RE: Calculating all possible ratios Hello, Nothing wrong with me, maybe your R

Re: [R] x axis dates

2012-05-12 Thread R. Michael Weylandt michael.weyla...@gmail.com
My guess is that this is sensitive to the size of the graphics device being used so the simplest thing to do is simply make your plot device bigger. Otherwise, we'll need a reproducible example. Michael On May 12, 2012, at 1:49 PM, pip philsiv...@hotmail.com wrote: The following data spans

[R] memory growth with rbind and lapply

2012-05-12 Thread Jack Tanner
This version of my code makes the R process consume unreasonable amounts of RAM: datf - rbind(lapply(mylist, function(item) { with(item, data.frame(col1, col2, col3)) })) This version works fine: datf - lapply(mylist, function(item) { with(item, data.frame(col1, col2, col3))

[R] Depmix: error while specifying the prior

2012-05-12 Thread deepakw
Hi, I am trying to specify a prior for my HMM Model. I would like both my prior and transition probablities to be dependent on covariates. I was trying this out using the speed dataset within depmixS4, but I get the following error: mod -

Re: [R] Plotmath bug or my misunderstanding?

2012-05-12 Thread David Winsemius
On May 12, 2012, at 6:27 PM, Peter Ehlers wrote: Hi Bert, I think the 'cex=' argument applies to the outermost 'atop()'. It then applies that size specification to each of the two components of the atop(a,b). If one of the components is itself another atop(a,b), then the individual parts are