[R] Selected matrices of an array and put into a list

2012-11-12 Thread Haris Rhrlp
Dear R users, I have an array that has matrices that i want BB[16,5,2:27] i want to put each of the 26 matrices into a List  thanks in advance [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Selected matrices of an array and put into a list

2012-11-12 Thread D. Rizopoulos
One approach is: BB - rnorm(6*5*27) dim(BB) - c(6, 5, 27) lapply(2:27, function (i) BB[, , i]) I hope it helps. Best, Dimitris On 11/12/2012 8:56 AM, Haris Rhrlp wrote: Dear R users, I have an array that has matrices that i want BB[16,5,2:27] i want to put each of the 26 matrices into a

[R] Bootstrapping issues

2012-11-12 Thread Clive Nicholas
sessionInfo()R version 2.15.2 (2012-10-26) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C [10]

Re: [R] Labeling position barchart

2012-11-12 Thread Geophagus
Hi and thanks a lot for your advices. Both work fine! Thanks GeoPhagUS -- View this message in context: http://r.789695.n4.nabble.com/Labeling-position-barchart-tp4649031p4649294.html Sent from the R help mailing list archive at Nabble.com. __

[R] A question about function of chisq.test fuction

2012-11-12 Thread 王佳茜
Why the result of chisq.test in R-2.15.1 between version Linux and version Windows XP is different. command is like attachment Thank you. -- 王佳茜 实习生 助理研究员 生物信息分析师 华大基因研究院|科学技术体系|3M|人方向|泛亚太 广东省深圳市盐田区北山工业区11栋 本科生 华中科技大学|生命科学与技术学院|系统生物学系 湖北省武汉市珞瑜路1037号

Re: [R] Bootstrapping issues

2012-11-12 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Clive Nicholas Sent: Monday, November 12, 2012 8:06 AM To: r-help@r-project.org Subject: [R] Bootstrapping issues sessionInfo()R version 2.15.2 (2012-10-26) Platform:

Re: [R] A question about function of chisq.test fuction

2012-11-12 Thread R. Michael Weylandt
2012/11/12 王佳茜 wangjiaq...@genomics.cn: Why the result of chisq.test in R-2.15.1 between version Linux and version Windows XP is different. command is like attachment Thank you. The R-help mail servers are not a big fan of attachments. Please resend putting your data and commands inline.

Re: [R] Selected matrices of an array and put into a list

2012-11-12 Thread arun
Hi, You can also use ?alply() library(plyr) BB-array(sample(1:500,3*5*27,replace=TRUE),dim=c(3,5,27)) res-alply(BB,3,function(x) x)[2:27] str(res) List of 26 #$ 2 : int [1:3, 1:5] 337 476 331 481 168 111 439 151 399 430 ... # $ 3 : int [1:3, 1:5] 77 171 225 498 277 37 429 472 215 351 ... # $ 4 :

[R] How to document Reference Classes using Roxygen? Will Roxygen3 work for those?

2012-11-12 Thread Johannes Graumann
Hi, Please see the subject line ;) Goolge only let me to people asking the same question, but no answers ... Am I out of luck with trying to in-line document Reference Classes? Thank you for your input. Sincerely, Joh __ R-help@r-project.org mailing

Re: [R] maximum likelihood estimation in R

2012-11-12 Thread Ben Bolker
David Winsemius dwinsemius at comcast.net writes: On Nov 10, 2012, at 9:22 PM, mmosalman wrote: I want to find ML estimates of a model using mle2 in bbmle package. When I insert new parameters (for new covariates) in model the log-likelihood value does not change and the estimated

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-12 Thread Clemontina Davenport
Thank you all for your responses, the lapply works perfectly. The example I gave IS odd. I only realized after I posted that tt had 5 rows and should have only had 3, so I apologize for that (I initially had X to have 5 list elements). Bert, I tend to use for loops in excess and often

Re: [R] FW: Two-line title in R legend

2012-11-12 Thread David Winsemius
On Nov 11, 2012, at 7:13 PM, Gabriel Toro wrote: Hi, I am trying to use a legend title that is a bit too long for one line. To try to break the title in two lines, I am using legend (title=Top of Title\nbottom of title, etc. ) R prints the title as two lines, but the top line is

[R] no y-axis

2012-11-12 Thread Geophagus
HI @ all, I'm looking for a simple solution to supress the y-axis - but only the drawn scale - not the values. Only the numbers should be displayed. I tried yaxt=n but there everything of the y-axis is supressed. Thanks GeO -- View this message in context:

[R] 1-KM and Cumulative incidence

2012-11-12 Thread cachimo
Dear I want to know how to plot 1-KM and Cumulative incidence curves in on graph. Thanks -- View this message in context: http://r.789695.n4.nabble.com/1-KM-and-Cumulative-incidence-tp4649301.html Sent from the R help mailing list archive at Nabble.com.

[R] problem with Erlang function

2012-11-12 Thread alen
I'm beginner with R language My goal is to write a function that takes an input Erlang entering your · Name · Name · Date of birth. The program will calculate age and display output first I do know the system date (month, day, year) I find with Sys.Date () I found a function. net to

[R] Adding Spatial Correlation Strucutre to Logistic Regression / Contingency Analysis

2012-11-12 Thread tfarkas
From what I can tell by reading forum posts etc., this is not a trivial issue. An answer in 2008 indicated some directions, but I'm curious whether any developments have been made since then. In my data set I have 182 observations with a binomial response, a 2-level explanatory factor, and x and

[R] srika...@codeforce.com

2012-11-12 Thread Srikanth Vallabhaneni
[1]Click here to unsubscribe if you no longer wish to receive our emails Dear Recruiter, Let me present you with list of consultants currently available. E-Mail me for below candidate details. My Mail ID : srika...@codeforce.com Consultant Job Title Total Experience Current

[R] R lmer SAS glimmix

2012-11-12 Thread Sophie GUERIN
Hi, I am trying to fit a model with lmer in R and proc glimmix in SAS. I have simplified my code but I am surprised to see I get different results from the two softwares. My R code is : lmer(y~age_cat + (1|cat),data=fic,family=binomial(link = logit), NaGQ=1) My SAS code is : ods output

Re: [R] 1-KM and Cumulative incidence

2012-11-12 Thread Kevin E. Thorpe
On 11/12/2012 06:50 AM, cachimo wrote: Dear I want to know how to plot 1-KM and Cumulative incidence curves in on graph. Thanks For 1-KM, see the fun argument to plot.survfit. Do you mean the Cumulative incidence curve for competing risks? If so, see the cmprsk package for one approach.

Re: [R] R lmer SAS glimmix

2012-11-12 Thread Bert Gunter
It's due to the different coding of contrasts. Post to R-sig-mixed models for a fuller explanation (though it has nothing to do with mixed models; the same would happen with lm) or search on a suitable phrase (e.g. contrast coding in SAS versus R) in R archives or via google etc. -- Bert On Mon,

Re: [R] no y-axis

2012-11-12 Thread Rui Barradas
Hello, Like this? plot(1:10, yaxt = n) axis(2, at = 1:10, labels = 1:10, tick = FALSE) Hope this helps, Rui Barradas Em 12-11-2012 10:08, Geophagus escreveu: HI @ all, I'm looking for a simple solution to supress the y-axis - but only the drawn scale - not the values. Only the numbers

[R] Matrix to data frame conversion

2012-11-12 Thread PavloEs
I have a matrix which I wanted to convert to a data frame. As I could not succeed and resorted to export to csv and reimport it again. Why did I fail in the attempt and how can I achieve what I wanted without this roundabouts? The original matrix: str(comb_model0) num [1:90, 1:4] 3.5938

[R] How to generate a random field with truncated marginal distributions?

2012-11-12 Thread Zhenglei Gao
I have asked the same question on stackoverflow but did not get a satisfying answer. I am trying to simulate a lognormal spatial random field but I need the simulated value in a certain range. So I need some easy to use functions to generate a truncated Gaussian field to start with. To be

[R] how to enter a string value

2012-11-12 Thread alen
hi, I want to know just enter a string value entering a numeric value is make with the function scan () or scan (nmax = ..) but it does not work for string my goal is to enter three string: name and surname and date of birth I try with this code but it shows me errors print (enter the

Re: [R] how to enter a string value

2012-11-12 Thread Gerrit Eichner
Alen, look at ?scan and there particularly at the argument 'what'. Hth -- Gerrit On Mon, 12 Nov 2012, alen wrote: hi, I want to know just enter a string value entering a numeric value is make with the function scan () or scan (nmax = ..) but it does not work for string my goal is

Re: [R] how to enter a string value

2012-11-12 Thread William Dunlap
scan(what=, nmax=1,sep=\n) 1: A four word string. Read 1 item [1] A four word string. readline(prompt=Please type a line ) Please type a line A line of text [1] A line of text readLines(n=1) A line of text. [1] A line of text. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com

Re: [R] Matrix to data frame conversion

2012-11-12 Thread Rui Barradas
Hello, I'm unable to reproduce your error, removing the space in Std. Error and changing t value to t.value the following read in as data.frame with no problems. x - read.table(text= Estimate Std.Error t.value Pr(|t|) (Intercept) 3.593793

[R] Multiple imputed data and variable selection / significance

2012-11-12 Thread Duarte Viana
Hello all, I used the MICE procedure (of package mice) to impute a dataset (I got m imputed datasets). Now I would like to fit a GLM with a poisson error distribution to regress a count variable on 14 continuous predictor variables and test for the significance of the different predictors by

Re: [R] How to generate a random field with truncated marginal distributions?

2012-11-12 Thread Ben Bolker
Zhenglei Gao zhenglei.gao at bayer.com writes: I have asked the same question on stackoverflow but did not get a satisfying answer. I am trying to simulate a lognormal spatial random field but I need the simulated value in a certain range. So I need some easy to use functions to generate

Re: [R] problem with Erlang function

2012-11-12 Thread R. Michael Weylandt
On Mon, Nov 12, 2012 at 1:49 PM, alen tarhouni_w...@hotmail.fr wrote: I'm beginner with R language My goal is to write a function that takes an input Erlang entering your · Name · Name · Date of birth. The program will calculate age and display output first I do know the system date

Re: [R] arrange data

2012-11-12 Thread Felipe Carrillo
Since you specifically want either nov or dec you actually don't need '=' use instead '= ='   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx From: Roslina Zakaria zrosl...@yahoo.com

[R] order in stacked barplot

2012-11-12 Thread kay
Hello i did a stacked barplot using ggplot and R arranged the bars of the items in different orders. i don´t know why. but i want to have the same order in every stacked bar. I used the code data1 - read.table(N_O_W_MAI.txt, header=TRUE, dec = ,) attach(data1)

Re: [R] no y-axis

2012-11-12 Thread Geophagus
Hi and thanks for your answer, I need no axis - only the labels. In your example 1 to 10. Greetz GeO -- View this message in context: http://r.789695.n4.nabble.com/no-drawn-y-axis-but-values-tp4649298p4649324.html Sent from the R help mailing list archive at Nabble.com.

[R] Using apply instead of for loop / multithreading

2012-11-12 Thread Charles D.
Hello , I'm new to R and don't really understand how to use the function apply instead of a for loop, particularly for a function with multiple entries. I have a big data file and would like to apply a function in multi thread to accelerate the processus. I have a data frame containing values

Re: [R] Using apply instead of for loop / multithreading

2012-11-12 Thread jim holtman
Since you did not provide sample data (use dput instead of posting links to 'jpg' files), you can probably do it without loops: k=resp[,5] CO2umol - resp[,6]*((Press*infoch[k,11]*1e-6)/(R*(resp[,7]+273.15))) CO2v - CO2umol/(infoch[k,10]) CO2s - CO2umol/(infoch[k,9] On Mon, Nov 12, 2012 at 12:39

Re: [R] no y-axis

2012-11-12 Thread Rui Barradas
Hello, If you want to completely remove the axis, overplot in color white. plot(1:10, yaxt = n) axis(2, at = 1:10, labels = 1:10, tick = FALSE) axis(2, at = 1:10, labels = 1:10, col = white) Hope this helps, Rui Barradas Em 12-11-2012 17:18, Geophagus escreveu: Hi and thanks for your answer,

Re: [R] How to generate a random field with truncated marginal distributions?

2012-11-12 Thread Mark Leeds
Hi: Not sure if totally relevant because I didn't read it but it might help or atleast be of interest. http://journal.r-project.org/archive/2010-1/RJournal_2010-1_Wilhelm+Manjunath.pdf On Mon, Nov 12, 2012 at 12:15 PM, Ben Bolker bbol...@gmail.com wrote: Zhenglei Gao zhenglei.gao at bayer.com

Re: [R] no y-axis

2012-11-12 Thread Marc Schwartz
Or perhaps something this: plot(1:10, axes = FALSE, ann = FALSE) axis(2, at = 1:10, tick = FALSE, lty = blank) and if you want the x axis: axis(1, at = 1:10) Not clear if you want the frame around the plot region or not. If so, there are some options using ?box and see ?par, specifically,

Re: [R] How to generate a random field with truncated marginal distributions?

2012-11-12 Thread Ben Bolker
On 12-11-12 02:05 PM, Mark Leeds wrote: Hi: Not sure if totally relevant because I didn't read it but it might help or atleast be of interest. http://journal.r-project.org/archive/2010-1/RJournal_2010-1_Wilhelm+Manjunath.pdf This definitely looks relevant. The critical question will be

Re: [R] Matrix to data frame conversion

2012-11-12 Thread arun
HI, I also have no trouble in reading the example data you gave, which BTW do not have any duplicate rownames.   I guess there must be some rows in the original dataset that must be repeated.  For example: comb_model-read.table(text=    Estimate Std.Error tvalue   

Re: [R] Matrix to data frame conversion

2012-11-12 Thread PavloEs
May be I have not clearly explained my problem. Le me try it again. My problem was with the matrix comb_model0 . I have tried to convert it to a data frame (xx), but could not succeed . As a result I have exported it to a test.csv file and re-imported it. Data frame test is the product of

Re: [R] no y-axis

2012-11-12 Thread arun
HI, May be this helps:  par(bty=n)  plot(1:10,yaxt=n)  axis(2, at = 1:10, labels = 1:10, tick = FALSE) A.K. - Original Message - From: Geophagus f...@retposto.net To: r-help@r-project.org Cc: Sent: Monday, November 12, 2012 12:18 PM Subject: Re: [R] no y-axis Hi and thanks for your

[R] System problem: Sys.time() returns GMT, says NZDT

2012-11-12 Thread Worik R
When I say: Sys.time() [1] 2012-11-12 21:30:14 NZDT But that is not what my clock on the wall and my system say. Cannot show you my clock but... worik@lemy:/tmp$ date Tue Nov 13 10:32:20 NZDT 2012 Sys.time() is returning GMT $version.string [1] R version 2.14.1 (2011-12-22)

Re: [R] Cropping a matrix by rows

2012-11-12 Thread Jeff Newmiller
Seems irrelevant to me. You can export the data to separate files directly from the matrix using matrix indexing. i.e. for (i in 1:2) { write.table( mat[rowcropping[2*i-1]:rowcropping[2*i],],paste0(file,i,.dat) } Please use reply to all to keep the discussion on the list.

Re: [R] change colour of geom_step by scale_colour_manual

2012-11-12 Thread Brian Diggs
On 11/6/2012 11:11 PM, ChangLH wrote: Hi, Color of my step plot is now by default. Now I'd like to change the color as the grey scale I specified. I don't know why I got three black plot. Here I attach two version of codes. The first one produces a step plot with color by default. The second

[R] select different variables from a list of data frames

2012-11-12 Thread Simon Kiss
Hi: How do I select different variables from a list of data frames. I have a list of 13 that looks like below. Each data frame has more variables than I need. How do I go through the list and select the variables that I need. In the example below, I need to get the variables a, and q10 and q14

Re: [R] standard error for quantile

2012-11-12 Thread Rolf Turner
My apologies for returning to this issue after such a considerable length of time ... but I wanted to check the result in Cramer's book, and only yesterday managed to get myself organised to go the library and check it out. What bothers me is what happens when f(Q.p) = 0. The formula that you

Re: [R] select different variables from a list of data frames

2012-11-12 Thread Rui Barradas
Hello, Try the following. lapply(mylist, function(x) x[,grep(a|q, names(x))]) Hope this helps, Rui Barradas Em 12-11-2012 22:34, Simon Kiss escreveu: Hi: How do I select different variables from a list of data frames. I have a list of 13 that looks like below. Each data frame has more

Re: [R] select different variables from a list of data frames

2012-11-12 Thread arun
Hi, In addition to: mylist-list(df1=data.frame(a=seq(1,10,1), c=seq(1,10,1), q10=rep('favour', 10)), df2=data.frame(a=seq(1,10,1), b=seq(15,24,1), q14=rep('favour', 10))) lapply(mylist,function(x) x[colnames(x)%in% c(a,q10,q14)]) you could also use: lapply(seq_along(mylist),function(i)

Re: [R] Bootstrapping issues

2012-11-12 Thread Clive Nicholas
Petr Pikal replied: [...] The following works results - boot(data=test, statistic=bs, R=1000, A~B+C+D+C*D) Actually it does not work either Correct, but I _did_ get it to work shortly before my initial post (sorry for not showing it, but I didn't save the output - silly me). What

Re: [R] standard error for quantile

2012-11-12 Thread Thomas Lumley
On Tue, Nov 13, 2012 at 11:59 AM, Rolf Turner rolf.tur...@xtra.co.nzwrote: My apologies for returning to this issue after such a considerable length of time ... but I wanted to check the result in Cramer's book, and only yesterday managed to get myself organised to go the library and check

[R] Getting information encoded in a SAS, SPSS or Stata command file into R.

2012-11-12 Thread andrewH
Dear folks – I have a large (26 gig) ASCII flat file in fixed-width format with about 10 million observations of roughly 400 variables. (It is 51 years of Current Population Survey micro data from IPUMS, roughly half the fields for each record). The file was produced by automatic process in

Re: [R] order in stacked barplot

2012-11-12 Thread Jeff Newmiller
Posting guide warns you to provide a reproducible example, which would include enough data to test code. As a general point of information I can say that data ordering in R graphs is normally driven by the factor level ordering, and you usually have to specify that explicitly when you convert

[R] Proc Nnpar1way with D option - equivalent in R

2012-11-12 Thread SASandRlearn
I am trying to match SAS output with R. I am using Proc Npar1way with D option to get KS test statistic. • Here X is a binary dependent variable and Y is the predicted probabilities; proc npar1way data = mydata D; class x; var y; run; When i try this in R ks.test(x, fitted(y),alternative =

Re: [R] select different variables from a list of data frames

2012-11-12 Thread sjkiss
Hi Arun: Exactly. That's exactly what I'm looking for! On 2012-11-12, at 5:55 PM, arun kirshna [via R] wrote: Hi, Seems like there was a typo in mylist mylist-list(df1=data.frame(a=seq(1,10,1), c=seq(1,10,1), q10=rep('favour', 10)), df2=data.frame(a=seq(1,10,1), b=seq(15,24,1),

[R] Invalid 'times' argument three-category ordered probit with maximum likelihood

2012-11-12 Thread jackle1o4
Hello, First time poster here so let me know if you need any more information. I am trying to run an ordered probit with maximum likelihood model in R with a very simple model (model - econ3 ~ partyid). Everything looks ok until i try to run the optim() command and that's when I get Error in

Re: [R] no y-axis

2012-11-12 Thread Geophagus
thanks, that works fine! good idea. I have one last question regarding this problem. My y-scale now is grouped from 0 - 4000 in 1000. Is it possible to set the scale into not equal breaks like 5,10,100,1000,5000 ? My axis now: axis(2,at=seq(0,4000,1000),col = white, las=1) thanks a lot GeO

Re: [R] Matrix to data frame conversion

2012-11-12 Thread David L Carlson
The problem seems to be that at least two of the 90 rows of your matrix have the same rowname (called dimnames in a matrix). When you converted to .csv, the rownames were added as a variable (called X) so they were not checked for duplicates. Try length(unique(test$X)). You should get a number

[R] reshape

2012-11-12 Thread farnoosh sheikhi
Hi, I have a R output that looks as follow: Rad:0 Rad1:2 Rad3:3 I want to make a new matrix that looks like : sample size is 2400 Variable    n11  n12 Rad            0     2400-0=2400 Rad1          2       2400-2 Rad3  3      2400-3   Thanks a lot for your time and help:) Best,Farnoosh Sheikhi

Re: [R] Using apply instead of for loop / multithreading

2012-11-12 Thread Charles D.
it works really faster ! thank you -- View this message in context: http://r.789695.n4.nabble.com/Using-apply-instead-of-for-loop-multithreading-tp4649326p4649346.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] for loop

2012-11-12 Thread arun
HI, You can do this in many ways: dat1-read.table(text= med1,med2,med3  1,0,1   0,1,1    2,0,0 ,sep=,,header=TRUE)   #1st method library(reshape) dat2-melt(dat1) dat3-aggregate(dat2$value,by=list(dat2$variable),sum)  colnames(dat3)-c(name,sum(n11))  dat3 #  name sum(n11) #1 med1  

Re: [R] reshape

2012-11-12 Thread arun
Hi, You can try this: dat1-read.table(text= Rad:0 Rad1:2 Rad3:3 ,sep=,header=FALSE)  Variable-do.call(rbind,lapply(strsplit(as.character(dat1[[1]]),split=:),`[`,1)) n11-do.call(rbind,lapply(strsplit(as.character(dat1[[1]]),split=:),function(x) as.numeric(x[2])))  n12-2400-n11  

Re: [R] Proc Nnpar1way with D option - equivalent in R

2012-11-12 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of SASandRlearn Sent: Monday, November 12, 2012 5:55 PM To: r-help@r-project.org Subject: [R] Proc Nnpar1way with D option - equivalent in R I am trying to match SAS output with