Re: [R] kmeans function

2014-03-27 Thread Prof Brian Ripley
On 26/03/2014 20:01, Tomassini, Letizia wrote: I would like to understand why the fastclus procedure in SAS is affected by the initial order of the data. So, with the same dataset, but sorted in a different way, I get different clusters rearrangements. I find this really disturbing. R seems

[R] R autocompletion configuration

2014-03-27 Thread Stas Malavin
Dear R-users, I experimented with readLine settings ('~/.inputrc') and then restored the file, but R still behaves like if '.inputrc' is modified. '/etc/inputrc' is also fine. I suppose there're some separate R-specific configuration files. Could you please kindly advise how to get things

[R] Bayesian 95% Credible interval

2014-03-27 Thread Baran rad
hi :) if i using importance sampling for obtain postreior density, can i use teachingdemos for obtain hpd interval?what are you doing with weight? or is other package for cmpute this type of sampling? please help me soon as soon [[alternative HTML version deleted]]

Re: [R] one more favor needed

2014-03-27 Thread arun
HI Eliza, May be this helps: set.seed(42)  el - matrix(sample(1:20,327*365,replace=TRUE),ncol=327)  colnames(el) - as.character(interaction(df1,sep=*))  el1 - el[,colnames(el) %in% as.character(interaction(df2,sep=*))]  dim(el1) #[1] 365   5 A.K. On Tuesday, March 25, 2014 4:15 PM, eliza botto

Re: [R] Merging two data frames

2014-03-27 Thread arun
Hi, Try: A - as.data.frame(matrix(1:20,byrow=TRUE,ncol=4)) B - as.data.frame(matrix(21:40,byrow=TRUE,ncol=4))  AB - rbind(A,B) #if the ?row.names of both datasets are from 1:nrow(dataset) AB1 - AB[order(as.numeric(c(row.names(A),row.names(B,] #or AB2 -

Re: [R] problem with previous code

2014-03-27 Thread arun
HI Elio, May be this helps:  indx - order(gsub(\\d+,,colnames(res))) res1 - res[indx,indx] A.K. On Thursday, March 27, 2014 6:24 AM, Elio Shijaku sel...@gmail.com wrote: Hi Arun, Thanks a lot for your continuous help. I am attaching a sample with the row / column names. Basically, the

[R] Selecting numbers not divisible by 3

2014-03-27 Thread Prabhakar Ghorpade
Hi, here's my code X - 1:100 I want to select number divisible by 3 out of them how can I select it? ( I tried following X - 1:100 DIV - Y - X/3 But I am getting whole number and number with fractions. WHole intgers are my number of interest from original X. How can I traceback to number

[R] lattice change font of one specific axis label in each panel

2014-03-27 Thread el_alisio
Dear R-users, I would like to change the font of one specific axis label to bold face in each panel. Taking one of Deepayan's plots as an example, how do I change All Postdoctorates to bold face? dotplot(prop.table(postdoc, margin = 1), groups = FALSE, index.cond = function(x, y) median(x), xlab

[R] using data.table ,plyr

2014-03-27 Thread Rohit Gupta
I have a data A which looks like author_id paper_id prob 731249431 731249431 731 6889741 731 964345.8 731 1201905.9 731 12679921 736249 .2 736 6889 1 736 94345.7

[R] Selecting numbers not divisible by 3

2014-03-27 Thread Prabhakar Ghorpade
Hi, here's my code X - 1:100 I want to select number divisible by 3 out of them how can I select it? ( I tried following X - 1:100 DIV - Y - X/3 But I am getting whole number and number with fractions. WHole intgers are my number of interest from original X. How can I traceback to number

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Berend Hasselman
On 27-03-2014, at 10:23, Prabhakar Ghorpade dr.prabhaka...@gmail.com wrote: Hi, here's my code X - 1:100 I want to select number divisible by 3 out of them how can I select it? ( I tried following X - 1:100 DIV - Y - X/3 But I am getting whole number and number with fractions.

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Jorge I Velez
Hi there, Try X[X %% 3 == 0] HTH, Jorge.- On Thu, Mar 27, 2014 at 6:46 PM, Prabhakar Ghorpade dr.prabhaka...@gmail.com wrote: Hi, here's my code X - 1:100 I want to select number divisible by 3 out of them how can I select it? ( I tried following X - 1:100 DIV - Y - X/3 But I

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread PIKAL Petr
Hi One option is seq(3,100,3) or you can use rounded numbers for comparison ?round Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Prabhakar Ghorpade Sent: Thursday, March 27, 2014 8:47 AM To: r-help@r-project.org

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Pascal Oettli
Hello, Something like that? R X - 1:100 R Y - X %% 3 R Y - ifelse(Y==0, TRUE, FALSE) R X[Y] [1] 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 [26] 78 81 84 87 90 93 96 99 HTH, Pascal On Thu, Mar 27, 2014 at 6:23 PM, Prabhakar Ghorpade dr.prabhaka...@gmail.com

Re: [R] problem with previous code

2014-03-27 Thread Elio Shijaku
Excellent Arun, it worked, many thanks. E. On Thu, Mar 27, 2014 at 11:55 AM, arun smartpink...@yahoo.com wrote: HI Elio, May be this helps: indx - order(gsub(\\d+,,colnames(res))) res1 - res[indx,indx] A.K. On Thursday, March 27, 2014 6:24 AM, Elio Shijaku sel...@gmail.com

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Rui Barradas
Hello, Inline. Em 27-03-2014 11:32, Pascal Oettli escreveu: Hello, Something like that? R X - 1:100 R Y - X %% 3 R Y - ifelse(Y==0, TRUE, FALSE) The ifelse here is not needed, you can simply do Y - Y == 0 Rui Barradas R X[Y] [1] 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54

[R] Multilevel Modelling

2014-03-27 Thread Laura Thomas
Hi All, I am using R for the purpose of multilevel modelling for the first time. I am trying to examine individuals interpersonal changes in the dependent variable over time and how this varies between groups. I am using the following code: treat.lme1-lme(DependentVariable~Treatment*I(Time-1),

Re: [R] reading dataset

2014-03-27 Thread eliza botto
Dear Pascal, Thanks for your reply. From your answer I perceived that if followings are first three elements of a file dput(ccc[1:3]) c(0.15912090241909, 0.167244642972946, 0.192471280694008) then 0.15912090241909 is precipitation magnitude , 0.167244642972946 is RSTN and 0.192471280694008 is

Re: [R] using data.table ,plyr

2014-03-27 Thread Hadley Wickham
It's rude to ask a question both on r-help and on stackoverflow (http://stackoverflow.com/questions/22685896), because people might spend their time answering your question when it's already been answered elsewhere. Hadley On Thu, Mar 27, 2014 at 6:01 AM, Rohit Gupta rhtgpt...@gmail.com wrote:

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Wed, 26 Mar 2014, Rich Shepard wrote: According to the ts.union help, ‘ts.union’ pads with ‘NA’s to the total time coverage but the problem seems to be that one series has a single NA while the other has 2 NAs. Both series have 792 rows of (date, value). I should have written in the

Re: [R] reading dataset

2014-03-27 Thread Frede Aakmann Tøgersen
No you're not right as far as I can tell from the read_v1100r2.f90 fortran code you can find in the download folder. For day 1 in 1961 I think that prcp = ccc[1:25200], rstn = ccc[25201:50400], and rsnw = ccc[50401:75600] and the same rule applies to the following days with appropriate

Re: [R] reading dataset

2014-03-27 Thread Pascal Oettli
Hi, Maybe I wasn't clear enough. Day 01 precip map of 180x140 Day 01 rstn map of 180x140 Day 01 flag map of 180x140 Day 02 precip map of 180x140 And so on HTH Pascal On Thu, Mar 27, 2014 at 10:14 PM, Frede Aakmann Tøgersen fr...@vestas.com wrote: No you're not right as far

Re: [R] reading dataset

2014-03-27 Thread eliza botto
Dear Frede and pascal, Thankyou very much. I am so glad that you replied positively. Thankyou very once again. Eliza From: kri...@ymail.com Date: Thu, 27 Mar 2014 22:38:42 +0900 Subject: Re: [R] reading dataset To: fr...@vestas.com CC: eliza_bo...@hotmail.com; r-help@r-project.org Hi,

[R] R CMD check and foreach code

2014-03-27 Thread Jannis
Dear R users, I have created a package and would like to check it for CRAN/R-Forge submission. I use some parallelized code with the help of foreach and doMC. R CMD check now gives me a warning even though my code is correctly programmed (at least I think that it is). The following dummy

Re: [R] lattice change font of one specific axis label in each panel

2014-03-27 Thread Kevin Wright
A reproducible example would help us help you, but you probably need to use the font argument, something along the lines of this... xlab = list(some axis label,cex=1.5,font=4) # 2=bold, 4 = bold italic Kevin On Thu, Mar 27, 2014 at 3:57 AM, el_alisio malnama...@gmx.de wrote: Dear R-users,

Re: [R] R CMD check and foreach code

2014-03-27 Thread Duncan Murdoch
On 27/03/2014 10:29 AM, Jannis wrote: Dear R users, I have created a package and would like to check it for CRAN/R-Forge submission. I use some parallelized code with the help of foreach and doMC. R CMD check now gives me a warning even though my code is correctly programmed (at least I think

[R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sneha Bishnoi
Hi all! I am trying to drop columns from a data frame dynamically depending on user input. The dataframe whose columns need to be dropped is called Finaldata So here is what I do: V is a dataframe with columns v1 and v2 as follows v1 v2 1 1 Shape 2 0 Length 3 0

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread William Dunlap
Why aren't you using ts.intersect instead of ts.union? Bill Dunlap TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepard Sent: Thursday, March 27, 2014 5:45 AM To:

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sarah Goslee
There are many ways. You're making it overly complicated Here, in an actual reproducible example (as you were requested to submit): V - data.frame(v1=c(1,0,0), v2=c(Shape, Length, Rate), stringsAsFactors=FALSE) Finaldata - data.frame(Shape = runif(5), Length = runif(5), Rate = runif(5)) #

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, William Dunlap wrote: Why aren't you using ts.intersect instead of ts.union? Bill, I was wondering the same thing. The reason (perhaps excuse would be the more appropriate term) is my emulating the example in Paul Cowpertwait and Andrew Metcalfe's Introductory Time

Re: [R] using data.table ,plyr

2014-03-27 Thread jim holtman
Here is how you can do it with data.table: x - read.table(text = author_id paper_id prob +731249431 +731249431 +731 688974 1 +731 964345.8 +731 1201905.9 +731 12679921 +736249 .2 +736 6889

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sneha Bishnoi
Hi Sarah, Thanks! Do agree its over complicated. However looking at the solutions I think I did not state my problem completely. V provides choices for only certain set of columns in Finaldata. So v2 may not represent all columns of Finaldata. I want to retain columns not provided as a choice for

Re: [R] kmeans function

2014-03-27 Thread Tomassini, Letizia
I have tried to read the source code but since I am not a computer engineer nor a computer programmer I was not able to fully understand it. I wonder if I should look for somebody here on campus (Washington State University) who may be able to read it for me. In any case, I think that David

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread David Carlson
That only requires two small changes in Sarah's first solution: Finaldata[, !colnames(Finaldata) %in% V$v2[V$v1 == 1]] Length Rate 1 0.53607323 0.01739951 2 0.15405615 0.11837908 3 0.04542388 0.53702702 4 0.15633703 0.68870041 5 0.35293973 0.38258981

[R] Moving Average Non Uniform Vectors

2014-03-27 Thread Luca Cerone
Dear all, I have a vector x and a vector y = f(x). e.g. x = c(0,1, 3,3.4, 5, 10, 11.23) y = x**2 + rnorm(length(x)) I would like to apply a moving average to y, knowing that the x values are not uniformly spaced. How can I do this in R? What alternatives I have to filter out the noise from Y??

Re: [R] R CMD check and foreach code

2014-03-27 Thread Jannis
On 27.03.2014 15:58, Duncan Murdoch wrote: I would use a slightly less dirty hack: call globalVariables() to declare that i is global. The foreach() function is using nonstandard evaluation to make this work, and codetools (that does the checks) doesn't know all the ins and outs of it.

Re: [R] R CMD check and foreach code

2014-03-27 Thread Duncan Murdoch
On 27/03/2014 12:46 PM, Jannis wrote: On 27.03.2014 15:58, Duncan Murdoch wrote: I would use a slightly less dirty hack: call globalVariables() to declare that i is global. The foreach() function is using nonstandard evaluation to make this work, and codetools (that does the checks)

Re: [R] R mail list archive Google search function not work

2014-03-27 Thread Martin Maechler
Marc Schwartz marc_schwa...@me.com on Wed, 26 Mar 2014 16:25:08 -0500 writes: On Mar 26, 2014, at 4:14 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 25, 2014, at 5:31 PM, Rolf Turner wrote: On 26/03/14 12:51, David Winsemius wrote: On Mar

Re: [R] R mail list archive Google search function not work

2014-03-27 Thread Marc Schwartz
On Mar 27, 2014, at 11:58 AM, Martin Maechler maech...@stat.math.ethz.ch wrote: Marc Schwartz marc_schwa...@me.com on Wed, 26 Mar 2014 16:25:08 -0500 writes: On Mar 26, 2014, at 4:14 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 25, 2014, at 5:31 PM, Rolf Turner wrote:

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, Rich Shepard wrote: I'll report back on whether that avoids the errors. Changing from ts.union() to ts.intersect() did not make a difference. So, I went back to bare metal by using awk to generate two-column text files, each consisting of a date and an interger or real

Re: [R] acf(ts.union()): Missing Values in Object

2014-03-27 Thread Rich Shepard
On Thu, 27 Mar 2014, Rich Shepard wrote: s95ec.z - read.zoo(s95ec.dat, sep = ., format = %Y-%m-%d ^ ) didn't copy but was present on the command line. Trying to

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sneha Bishnoi
Thank you! Works like a charm! On Thu, Mar 27, 2014 at 12:19 PM, David Carlson dcarl...@tamu.edu wrote: That only requires two small changes in Sarah's first solution: Finaldata[, !colnames(Finaldata) %in% V$v2[V$v1 == 1]] Length Rate 1 0.53607323 0.01739951 2 0.15405615

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Prabhakar Ghorpade
Pascal, Jorge, Berend, Pikal and Rui. Thanks all it helps. On Thu, Mar 27, 2014 at 8:18 PM, Prabhakar Ghorpade dr.prabhaka...@gmail.com wrote: Hi, How do I find help on %% Regards, Prabhakar On Thu, Mar 27, 2014 at 4:56 PM, Jorge I Velez jorgeivanve...@gmail.comwrote: Hi there,

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Prabhakar Ghorpade
Hi, How do I find help on %% Regards, Prabhakar On Thu, Mar 27, 2014 at 4:56 PM, Jorge I Velez jorgeivanve...@gmail.comwrote: Hi there, Try X[X %% 3 == 0] HTH, Jorge.- On Thu, Mar 27, 2014 at 6:46 PM, Prabhakar Ghorpade dr.prabhaka...@gmail.com wrote: Hi, here's my code X -

[R] completely different results for shapiro.test and ks.test

2014-03-27 Thread Hermann Norpois
Hello, My main question is wheter my data is distributed normally. As the shapiro.test doesnt work for large data sets I prefer the ks.test. But I have some problems to understand the completely different p-values: ks.test (test, pnorm, mean (test), sd (test)) One-sample

[R] generate

2014-03-27 Thread IZHAK shabsogh
i try to generate 27*5  matrix of observation using the following code but is given error kindly assist and correct the problem  x1-c(-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1) x2-c(-1,-1,-1,0,0,0,1,1,1,-1,-1,-1,0,0,0,1,1,1,-1,-1,-1,0,0,0,1,1,1)

[R] Clinical significance - Equivalence test

2014-03-27 Thread Manuel Carona
Hi, I have implemented a therapeutic intervention on two groups (one is a control group) and tested them in two moments using some assessment tools (with normative data). Now I want to compare the experimental group with the control group using clinical equivalence testing. To do this I need to

Re: [R] lattice change font of one specific axis label in each panel

2014-03-27 Thread el_alisio
Hi Kevin, thanks for the advice! The code is now reproducible. Sorry! Actually I wanted to print only one x-label (All Postdoctorates) in bold face, not all of them. This would be easily achieved, if All Postdoctorates appeared always in the same row of each panel, but this is not the case here.

[R] Finding max number in R

2014-03-27 Thread Prabhakar Ghorpade
Hello, If I have x-c(5,9,8,3,4,5,6,7,) and y -(a, b,c, d,e,f, g,h) and D - data.frame(x,y) I did this max(x) and My expectede anwer is b. How do I select element in y which correspond to maximum number in x? thanks. regards, Prabhakar [[alternative HTML version deleted]]

Re: [R] Moving Average Non Uniform Vectors

2014-03-27 Thread jim holtman
Here is one way. I took your data and applied the 'approx' function to get evenly spaced values and then 'filter' to create a moving average of a window of size 5. set.seed(1) x = c(0,1, 3,3.4, 5, 10, 11.23) y = x**2 + rnorm(length(x)) rbind(x, y) # create 'even' spacing using the 'approx'

Re: [R] using data.table ,plyr

2014-03-27 Thread Rohit Gupta
ok btw thanks On Thu, Mar 27, 2014 at 5:55 PM, Hadley Wickham h.wick...@gmail.com wrote: It's rude to ask a question both on r-help and on stackoverflow (http://stackoverflow.com/questions/22685896), because people might spend their time answering your question when it's already been

[R] index polygons

2014-03-27 Thread Leonid Shvartser
Hello, I need to compare a polygon with a set of other polygons. I'd like to index polygons with a grid in order not to compare definitely distant ones. How can I do this? I need 1. Transform polygons to cells 2. Find cell neighbors (defined cell distance) for a polygon Thanks

Re: [R] generate

2014-03-27 Thread jim holtman
It would have been helpful it you had posted the error message you got. Here is what I got running your code: Error in x.matrix[i, j] - rnorm(5, mu[i], sig[i]) : object 'j' not found No suitable frames for recover() It seems you have not defined 'j' that you trying to index with. Jim Holtman

Re: [R] Finding max number in R

2014-03-27 Thread jim holtman
First, read the Introduction to R to understand what dataframes are and how to access data within them. Then correct you code so it does not have error: 'x' has a trailing comma and 'y' was not call the 'c' function. Once you have done that, you might get the following: x-c(5,9,8,3,4,5,6,7)

Re: [R] dataframe calculations based on certain values of a column

2014-03-27 Thread johannesradin...@gmail.com
Thanks, your solution using ave() works perfectly. /johannes -Ursprüngliche Nachricht- Von: Bert Gunter gunter.ber...@gene.com An: Johannes Radinger johannesradin...@gmail.com Cc: R help r-help@r-project.org Gesendet: Mittwoch, 26. März 2014 16:45:43 GMT+00:00 Betreff: Re: [R] dataframe

Re: [R] Clinical significance - Equivalence test

2014-03-27 Thread David Winsemius
On Mar 27, 2014, at 6:53 AM, Manuel Carona wrote: Hi, I have implemented a therapeutic intervention on two groups (one is a control group) and tested them in two moments using some assessment tools (with normative data). Now I want to compare the experimental group with the control group

Re: [R] generate

2014-03-27 Thread David Winsemius
On Mar 27, 2014, at 4:31 AM, IZHAK shabsogh wrote: i try to generate 27*5 matrix of observation using the following code but is given error kindly assist and correct the problem x1-c(-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1)

Re: [R] index polygons

2014-03-27 Thread Frede Aakmann Tøgersen
Perhaps have a look at the sp package and especially the over function. Br. Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: Leonid Shvartser Dato:27/03/2014 20.27 (GMT+01:00) Til: r-help@r-project.org Emne: [R] index polygons Hello, I need to compare a polygon with

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread David Winsemius
On Mar 27, 2014, at 7:48 AM, Prabhakar Ghorpade wrote: Hi, How do I find help on %% ?'%%' # Need to quote specials Also look at: ?'-' ?'%in% ?'function' -- David. Regards, Prabhakar On Thu, Mar 27, 2014 at 4:56 PM, Jorge I Velez jorgeivanve...@gmail.comwrote: Hi there,

Re: [R] Clinical significance - Equivalence test

2014-03-27 Thread Marc Schwartz
On Mar 27, 2014, at 8:53 AM, Manuel Carona unku...@gmail.com wrote: Hi, I have implemented a therapeutic intervention on two groups (one is a control group) and tested them in two moments using some assessment tools (with normative data). Now I want to compare the experimental group with

Re: [R] completely different results for shapiro.test and ks.test

2014-03-27 Thread Marc Schwartz
On Mar 27, 2014, at 8:14 AM, Hermann Norpois hnorp...@gmail.com wrote: Hello, My main question is wheter my data is distributed normally. As the shapiro.test doesnt work for large data sets I prefer the ks.test. But I have some problems to understand the completely different p-values:

Re: [R] Clinical significance - Equivalence test

2014-03-27 Thread Jim Lemon
On 03/28/2014 12:53 AM, Manuel Carona wrote: Hi, I have implemented a therapeutic intervention on two groups (one is a control group) and tested them in two moments using some assessment tools (with normative data). Now I want to compare the experimental group with the control group using

[R] going backward in code

2014-03-27 Thread Prabhakar Ghorpade
Hi, when typing code I get like this x -(1,2, + + + Can I delete + and comma after 2 and go back to end of comma as x -c(1,2) Thanks. Prabhakar -- Dr.Ghorpade Prabhakar B. Ph.D. Scholar ( Animal Biochemistry) Indian Veterinary Research Institute. India [[alternative HTML

Re: [R] generate

2014-03-27 Thread MacQueen, Don
Or, to show the power of the R language, so to speak, and assuming that Dave is correct, there is no need to use a for() loop: xmat - matrix( rnorm( 27*5, rep(mu,5), rep(sig,5) ) , nrow=27) To verify that I've created the vectors in the right order, and converted to a matrix in the right order,

Re: [R] Bayesian 95% Credible interval

2014-03-27 Thread Greg Snow
The hpd functions in the TeachingDemos package do not currently take weights, so they will not work with the results of importance sampling. On Wed, Mar 26, 2014 at 10:35 PM, Baran rad baran@gmail.com wrote: hi :) if i using importance sampling for obtain postreior density, can i use

Re: [R] going backward in code

2014-03-27 Thread Jim Lemon
On 03/28/2014 06:33 AM, Prabhakar Ghorpade wrote: Hi, when typing code I get like this x-(1,2, + + + Can I delete + and comma after 2 and go back to end of comma as x-c(1,2) Hi Prabhakar, I don't think so, as the command line reading won't pass your backspace. I'd say just press

Re: [R] generate

2014-03-27 Thread David Carlson
Or tweaking Don's solution but using the original mu and sig vectors: set.seed(42) x.matrix-matrix(0, nrow=27, ncol=5) for(i in 1:27){ + x.matrix[i, ] - rnorm(5, mu[i], sig[i]) + } set.seed(42) xmat - matrix(rnorm(27*5, rep(mu, each=5), rep(sig, each=5)), + nrow=27, byrow=TRUE)

[R] summarizing a dataset on a factor

2014-03-27 Thread Tom Wright
Hi all, I've spent too long in matlab land recently and seem to have forgotten my R skillz ;-) I'm sure I'm missing a simple way to do this... Given a data frame id-rep(1:5,2) eye-c(rep('l',5),rep('r',5)) age-rep(round(runif(5,0,12)),2) response-round(runif(10,1,10)*10)/10

Re: [R] ? ~ ADONIS

2014-03-27 Thread Tom Wright
I'm no expert on the adonis functions by the error you are getting usually means the dataset is not quite what you expected. Are you sure the event dataset is loading as you expect? On Tue, 2014-03-25 at 16:36 -0400, Maggie Wisniewska wrote: Hello, I am an R noivce, so excuse my simple

Re: [R] summarizing a dataset on a factor

2014-03-27 Thread David Carlson
It may be possible to do this in a single step, but x1 - aggregate(response~id+age, data, mean) x2 - data[data$eye==l, c(id, response2)] merge(x1, x2) id age response response2 1 1 2 4.60 High 2 2 9 2.65 High 3 3 5 3.65 High 4 4 2 7.55 High 5

Re: [R] using data.table ,plyr

2014-03-27 Thread arun
Hi, You could try: library(dplyr)  A %.% group_by(author_id) %.% arrange(desc(prob)) %.% summarise(paper_id=paste(paper_id,collapse=,)) A.K. On Thursday, March 27, 2014 11:40 AM, Rohit Gupta rhtgpt...@gmail.com wrote: I have a data A which looks like     author_id paper_id prob      

Re: [R] summarizing a dataset on a factor

2014-03-27 Thread Tom Wright
Thanks David, Neat use of merge there. I think I can also do this with: ddply(data,.(id),f) On Thu, 2014-03-27 at 16:06 -0500, David Carlson wrote: It may be possible to do this in a single step, but x1 - aggregate(response~id+age, data, mean) x2 - data[data$eye==l, c(id, response2)]

Re: [R] Selecting numbers not divisible by 3

2014-03-27 Thread Bert Gunter
?%% PLEASE read an Introduction to R (ships with R) or an online tutorial of your choice before posting further. You then will not have to waste nearly as much time (yours and ours) posting and waiting for answers! Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374

Re: [R] lattice change font of one specific axis label in each panel

2014-03-27 Thread David Winsemius
On Mar 27, 2014, at 8:11 AM, el_alisio wrote: Hi Kevin, thanks for the advice! The code is now reproducible. Sorry! No, it is not, since you can only read it on Nabble, yecch. There is some sort of weird format stuff that Nabble does that prevents code from appearing on Rhelp copies.

Re: [R] lattice change font of one specific axis label in each panel

2014-03-27 Thread David Winsemius
On Mar 27, 2014, at 2:34 PM, David Winsemius wrote: On Mar 27, 2014, at 8:11 AM, el_alisio wrote: Hi Kevin, thanks for the advice! The code is now reproducible. Sorry! No, it is not, since you can only read it on Nabble, yecch. There is some sort of weird format stuff that Nabble

[R] Problem with do.call().

2014-03-27 Thread Rolf Turner
I was under the impression that do.call(foo,list(x=x,y=y)) should yield the same result as foo(x,y). However if I do x - 1:10 y - (x-5.5)^2 do.call(plot,list(x=x,y=y)) I get the expected plot but with the y-values (surrounded by c()) being printed

Re: [R] Problem with do.call().

2014-03-27 Thread Thomas Lumley
You get what you wanted from do.call(plot,list(x=quote(x),y=quote(y))) By the time do.call() gets the arguments it doesn't know how y was originally computed, just what values it has. -thomas On Thu, Mar 27, 2014 at 6:17 PM, Rolf Turner r.tur...@auckland.ac.nzwrote: I was under the

Re: [R] Problem with do.call().

2014-03-27 Thread Duncan Murdoch
On 27/03/2014, 7:17 PM, Rolf Turner wrote: I was under the impression that do.call(foo,list(x=x,y=y)) should yield the same result as foo(x,y). However if I do x - 1:10 y - (x-5.5)^2 do.call(plot) I get the expected plot but with the y-values

Re: [R] Problem with do.call().

2014-03-27 Thread Duncan Murdoch
On 27/03/2014, 7:38 PM, Thomas Lumley wrote: You get what you wanted from do.call(plot,list(x=quote(x),y=quote(y))) By the time do.call() gets the arguments it doesn't know how y was originally computed, just what values it has. This works, but it doesn't make sense to me. The arguments end

[R] Select random observation from a group

2014-03-27 Thread Whitney Melroy
Hello, I have a dataset with family data. For an analysis, I need to select one subject per family at random. Here is an example of what my data look like: FamilyID IndividualID DadIDMomID Sex 1101103 104 1 1

Re: [R] Problem with do.call().

2014-03-27 Thread Rolf Turner
On 28/03/14 12:49, Duncan Murdoch wrote: On 27/03/2014, 7:17 PM, Rolf Turner wrote: I was under the impression that do.call(foo,list(x=x,y=y)) should yield the same result as foo(x,y). However if I do x - 1:10 y - (x-5.5)^2 do.call(plot) I get the expected plot but

Re: [R] Select random observation from a group

2014-03-27 Thread Peter Alspach
Tena koe Whitney tapply should work. Try: tapply(yourData$IndividualID, yourData$FamilyID, sample, size=1) # untested HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Whitney Melroy Sent: Friday, 28 March

Re: [R] Select random observation from a group

2014-03-27 Thread arun
Hi, May be this helps: set.seed(42) indx - with(df,tapply(seq_along(IndividualID), FamilyID,FUN=sample,1))  df[indx,] # FamilyID IndividualID DadID MomID Sex #4    1  104 0 0   2 #8    2  204   202   203   2 #or library(plyr)  ddply(df,.(FamilyID),function(x)

[R] Multcomp for interaction term

2014-03-27 Thread Worthington, Thomas A
Dear All I have a model of the form Approaches ~ Setup * Minute, where Setup has two levels and Minute has three levels. I want to test the difference between the levels of setup (Control vs Test) within in levels minute e.g. the difference between the two setups for Minute 1, Minute 2 and

[R] accessing members of a list

2014-03-27 Thread Bill
Hi. I ran some code and I am trying to access the table with the data in it. I want in particular to delete the 31st row for example Monthly means and totals: NA NA NA NA NA NA NA NA NA NA NA NA NA or remove the names of the columns (or change them). DayT TM Tm SLPHPP VVV

Re: [R] accessing members of a list

2014-03-27 Thread Pascal Oettli
Hello, Your example leads to error. Anyway: library(XML) oneurl=http://www.tutiempo.net/en/Climate/FUKUSHIMA/11-2012/475950.htm; temp.tables=readHTMLTable(oneurl, header=TRUE) temp.tables - temp.tables[[3]] temp.tables - temp.tables[1:30,] HTH, Pascal On Fri, Mar 28, 2014 at 2:42 PM, Bill

[R] Centered difference operation on matrix with R

2014-03-27 Thread Pascal Oettli
Dear list members, I am wondering whether there is any more efficient way to calculate centered difference on matrix in R? Please see herewith an example: lon - matrix(rep(seq(0,2,length.out=1e3), 1e3), 1e3, 1e3) lat - matrix(rep(seq(0,2,length.out=1e3), each=1e3), 1e3, 1e3) x -