[R] Problems with R package building

2013-06-14 Thread jpm miao
Hi, I try to build a toy package by running the following codes in an R program require(stats) f - function(x,y) x+y g - function(x,y) x-y d - data.frame(a=1, b=2) e - rnorm(1000) package.skeleton(list=c(f,g,d,e), name=test1pkg, path=D:/R/pkgtest) Then the program runs smoothly Creating

Re: [R] merging data frames

2013-06-14 Thread Jim Holtman
?merge Sent from my iPad On Jun 14, 2013, at 0:51, Yasin Gocgun entropy...@gmail.com wrote: Hi, I have been struggling with the issue of merging data frames that have common columns and have different dimensions. Although I made alot of search about it on internet, I could not find any

Re: [R] merging data frames

2013-06-14 Thread Yasin Gocgun
Thanks for your responses. I have already found that merge function performs what I am looking for. On Fri, Jun 14, 2013 at 12:51 AM, Yasin Gocgun entropy...@gmail.com wrote: Hi, I have been struggling with the issue of merging data frames that have common columns and have different

[R] Need help on creating Adjacency matrix in R

2013-06-14 Thread rn27in .
Hello everyone I am relatively new to R and wanted some help on creating adjacency matrix I have a dataset as given below and wanted to create an adjacency matrix in R. For creating an adjacency matrix, the matrix should be a square matrix. I tried creating a matrix directly, but it would not be

Re: [R] Problems with R package building

2013-06-14 Thread Michael Weylandt
On Jun 14, 2013, at 7:18, jpm miao miao...@gmail.com wrote: Hi, I try to build a toy package by running the following codes in an R program require(stats) f - function(x,y) x+y g - function(x,y) x-y d - data.frame(a=1, b=2) e - rnorm(1000) package.skeleton(list=c(f,g,d,e),

[R] how to output the data array without colname and row number

2013-06-14 Thread Jie Tang
hi r users: I have a datadset and want to write into a file . when i use : write.table(u_bar, file = u_test.txt) the data in the outpuf file is shown as below which included the row number from 1 to 14 and colname .e.g.X32N How could I output the numbers and excluded the colname and row

Re: [R] how to output the data array without colname and row number

2013-06-14 Thread Jim Holtman
how about reading the help file on 'write.table' and look at row.names and col.names. Sent from my iPad On Jun 14, 2013, at 3:27, Jie Tang totang...@gmail.com wrote: hi r users: I have a datadset and want to write into a file . when i use : write.table(u_bar, file = u_test.txt) the

Re: [R] How to get a running mean result by R?

2013-06-14 Thread Rui Barradas
Hello, As for Inf, the mean value of Inf and anything is Inf, so there's no way to solve it. As for NaN, you can set them to NA prior to calling the function. That leaves us with NA handling. forecast::ma handles NAs, it propagates them, as it should. An alternative function using filter()

[R] Problem in Matrix

2013-06-14 Thread Fazli Raziq
Hello, Suppose, I have P = 100 genes variables and each consists of n = 50 values. Now I want to Bootstrap (With Replacement) 50 times and 100 iterations. I want P in columns and Bootstrap iterations in Rows. Also, when genes are selected in Bootstrap (WR) give it value 1, if not selected 0. I

[R] Problem in linking a library in R package

2013-06-14 Thread Gaurav Sehrawat
Hello everyone , I am facing a simple problem , I trying to add functionality in one of R package . I want a profiling library to link to R package so that when R package is used the profiling out put comes automatically with that. Problem is that I am not able to link it with the package , I

[R] rename and concatenate name of columns

2013-06-14 Thread Arman Eshaghi
Dear all, I have different data frames for which I would like to modify names of each column such that the new name would include the name of the first column added to the name of other columns; I came up with the following code. Nothing changes when I run the following code. I would be grateful

Re: [R] Need help on creating Adjacency matrix in R

2013-06-14 Thread arun
HI, May be this helps: dat1- read.table(text= Col1 Col2 Weight   A D 0.1   B C 0.4   C M 0.6   D P 0.8   E W 1   F D 1.2   G C 3.1   H M 4 ,sep=,header=TRUE,stringsAsFactors=FALSE)  vec1- c(unique(dat1[,1]),unique(dat1[,2])) datNew- expand.grid(vec1,vec1) colnames(datNew)- colnames(dat1)[-3]

Re: [R] Problem in linking a library in R package

2013-06-14 Thread Duncan Murdoch
On 13-06-14 3:47 AM, Gaurav Sehrawat wrote: Hello everyone , I am facing a simple problem , I trying to add functionality in one of R package . I want a profiling library to link to R package so that when R package is used the profiling out put comes automatically with that. Problem is that I

Re: [R] rename and concatenate name of columns

2013-06-14 Thread arun
Hi, rename_columns- function(dat){     for(i in 2:(ncol(dat))){     names(dat)[i]- paste(names(dat)[1],names(dat)[i],sep=_)         } dat } dat1- read.table(text= chr    pos    ref    alt chr1    5    A    G chr1    8    T    C chr2    2    C    T ,sep=,header=TRUE,stringsAsFactors=FALSE)  

Re: [R] rename and concatenate name of columns

2013-06-14 Thread Ista Zahn
On Fri, Jun 14, 2013 at 10:01 AM, arun smartpink...@yahoo.com wrote: Hi, rename_columns- function(dat){ for(i in 2:(ncol(dat))){ names(dat)[i]- paste(names(dat)[1],names(dat)[i],sep=_) } dat } Or even better, get rid of the unnecessary loop: rename_columns - function(DF) {

[R] Removing NA from matrix

2013-06-14 Thread Katherine Gobin
Dear R forum, I have a data frame dat = data.frame( ABC = c(25.28000732,48.33857234,19.8013245,10.68361461), DEF = c(14.02722251,10.57985168,11.81890316,21.40171514), GHI = c(1,1,1,1), JKL = c(45.96423231,44.52986236,16.56514176,32.14545122), MNO =

Re: [R] rename and concatenate name of columns

2013-06-14 Thread Arman Eshaghi
Thanks all! On Fri, Jun 14, 2013 at 6:40 PM, Rainer Schuermann rainer.schuerm...@gmx.net wrote: df1 - data.frame( A = runif( 10 ), B = runif( 10 ) * 5, C = runif( 10 ) * 10, D = runif( 10 ) * 20 ) df2 - data.frame( X = runif( 10 ), Y = runif( 10 ) * 5, Z = runif( 10 ) * 10 )

Re: [R] Removing NA from matrix

2013-06-14 Thread arun
HI, Try: dat1-dat[sapply(dat,function(x) length(unique(x)))1] cor(dat1) #   ABC DEF JKL    MNO #ABC  1.000 -0.75600764  0.55245223 -0.2735585 #DEF -0.7560076  1. -0.06479082  0.2020781 #JKL  0.5524522 -0.06479082  1.  0.4564568 #MNO -0.2735585 

Re: [R] Removing NA from matrix

2013-06-14 Thread arun
Probably, this also works: dat2-dat[,(colSums(dat)/dat[1,])!=nrow(dat)] cor(dat2) dat$NewCol-5  dat3-dat[,(colSums(dat)/dat[1,])!=nrow(dat)]  cor(dat3) #   ABC DEF JKL    MNO #ABC  1.000 -0.75600764  0.55245223 -0.2735585 #DEF -0.7560076  1. -0.06479082 

Re: [R] rename and concatenate name of columns

2013-06-14 Thread Rainer Schuermann
df1 - data.frame( A = runif( 10 ), B = runif( 10 ) * 5, C = runif( 10 ) * 10, D = runif( 10 ) * 20 ) df2 - data.frame( X = runif( 10 ), Y = runif( 10 ) * 5, Z = runif( 10 ) * 10 ) rename_columns - function( dataset ) { for( i in 2:ncol( dataset ) ) colnames( dataset )[i] -

Re: [R] find the position of first observation for each subject

2013-06-14 Thread MacQueen, Don
I would typically use rle() for this kind of thing: tmp - cumsum(rle(id)$lengths) c(1, tmp[-length(tmp)]+1) [1] 1 4 9 It does assume that all rows for each unique value of id are grouped together, but does not require that the rows be sorted by id. -Don -- Don MacQueen Lawrence Livermore

Re: [R] Removing NA from matrix

2013-06-14 Thread David Winsemius
On Jun 14, 2013, at 7:03 AM, Katherine Gobin wrote: Dear R forum, I have a data frame dat = data.frame( ABC = c(25.28000732,48.33857234,19.8013245,10.68361461), DEF = c(14.02722251,10.57985168,11.81890316,21.40171514), GHI = c(1,1,1,1), JKL =

Re: [R] rename and concatenate name of columns

2013-06-14 Thread David Winsemius
On Jun 14, 2013, at 6:34 AM, Arman Eshaghi wrote: Dear all, I have different data frames for which I would like to modify names of each column such that the new name would include the name of the first column added to the name of other columns; I came up with the following code. Nothing

Re: [R] Problem in linking a library in R package

2013-06-14 Thread Gaurav Sehrawat
I have posted the question on stackoverflow but no satisfied there. Here is the Link : http://stackoverflow.com/questions/17049966/how-to-include-a-shared-library-so-or-library-in-a-r-package Thanks On Fri, Jun 14, 2013 at 7:15 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 13-06-14

[R] How to interactively create manually guided Decision Tree

2013-06-14 Thread Neelesh Gupta
I am new in using R. I want to know all about building decision tree model in R. Few options which I searched are rpart and rattle to build a decision tree.Both the functions are giving me splits which are statistically appropriate. But I am not able to figure out how to change those splits as

[R] R session freezes when I try to save a new script

2013-06-14 Thread anferg806
All: Recently my R session freezes when I try to open a file or save a new script after I have run existing scripts. The session freezes so that I can no longer click on any windows within the R session -- including other scripts that are open or the R console. (I hear the ding sound when I

Re: [R] R session freezes when I try to save a new script

2013-06-14 Thread John Kane
It would probably help if you posted your sessionInfo() Just before everything freezes issue the command sessionInfor() copy the output and paste it into an email. John Kane Kingston ON Canada -Original Message- From: anferg...@aol.com Sent: Fri, 14 Jun 2013 10:52:03 -0400 (EDT)

[R] Trying to get the 'Digitize' package

2013-06-14 Thread Jean-Michel Fortin
Dear R users, I'm trying to get the 'Digitize' package but it has been removed from the CRAN repository. I tried to download the .tar.gz file from the archive but I haven't been able to install it. Anyone has a clue on how I could proceed to access this package? Thanks Jean-Michel Fortin

Re: [R] How to interactively create manually guided Decision Tree

2013-06-14 Thread Bert Gunter
You need to do some reading, both about decision trees and R! What you need to do for R is to use cut() on Age (?cut) to create a new categorical variable, ageCat, say, and then use that in your tree building instead of Age. Cheers, Bert On Fri, Jun 14, 2013 at 7:24 AM, Neelesh Gupta

Re: [R] Trying to get the 'Digitize' package

2013-06-14 Thread Greg Snow
You can check the archive section of your CRAN mirror to see if there are older versions of the package there that may work for you. An alternative approach if you have a graphics file of a plot that you want to extract the data from by clicking on the points (ignore the rest of this if I am

[R] MS Access

2013-06-14 Thread Raghuraman Ramachandran
Dear guRus Can I use R inside Microsoft access Macros and programmes? I understand that R-Excel is compatible but wish to know if I can use R inside Access programmes please? Many thanks Raghu [[alternative HTML version deleted]] __

Re: [R] MS Access

2013-06-14 Thread David Winsemius
On Jun 14, 2013, at 10:04 AM, Raghuraman Ramachandran wrote: Dear guRus Can I use R inside Microsoft access Macros and programmes? I understand that R-Excel is compatible but wish to know if I can use R inside Access programmes please? RExcel has a separate mailing list. You should ask

Re: [R] R session freezes when I try to save a new script

2013-06-14 Thread Jeff Newmiller
You will probably need to read the Posting Guide and follow its recommendations to get a constructive response. Things like posting in text instead of HTML and providing the output of sessionInfo go a long way toward speeding up the troubleshooting process. You can also begin the process of

Re: [R] survreg with measurement uncertainties

2013-06-14 Thread Kyle Penner
Hrm, thanks. The uncertainties are what they are, though (and the model is what it is, too) -- is there an alternative to modifying them? Maybe another type of analysis that handles upper limits? Kyle On Thu, Jun 13, 2013 at 5:46 AM, Andrews, Chris chri...@med.umich.edu wrote: It seems a line

[R] addtable2plot problem with adding summary object

2013-06-14 Thread Erel JOFFE
Hello, I am trying to add a summary generated by summary () to a plot.The output of the summary is an object of class (summaryDefault,table) When I try to add it with addtable2plot (x=topright,sum_1) I get an error:Error in dim(table) : 'table' is missing Here is some info about sum_1: print

Re: [R] rename and concatenate name of columns

2013-06-14 Thread Bert Gunter
For the record: ... A bit of commentary: Something did happen. It's just that you didn't do anything with _what_ happened. The copy of the 'dataset'-object got modified but you never returned it from the function, and and also didn't reassign it to the original 'dataset'.

Re: [R] matched samples, dataframe, panel data

2013-06-14 Thread arun
Hi, I changed the fun1().  Now, it should be possible to get all the possible combinations within each group. final3New-read.table(file=real_data_cecilia.txt,sep=\t,header=T) final3New1-read.csv(real_data_cecilia_new.csv) fun1New- function(dat,percent,number){     lst1-

[R] combination of columns in a matrix

2013-06-14 Thread Hermann Norpois
Hello, I have a matrix m and I want to know how often does 1 (or !0) simultanously appear in A and REF, B and REF, C and REF. So actually I wish to automate following expression: length (which (m[,1]!=0m[,4]!=0)) [1] 2 length (which (m[,2]!=0m[,4]!=0)) [1] 1 Thanks Hermann m A B C REF

[R] significance testing for the difference in the ratio of means

2013-06-14 Thread Rahul Mahajan
I have a question regarding significance testing for the difference in the ratio of means. The data consists of a control and a test group, each with and without treatment. I am interested in testing if the treatment has a significantly different effect (say, in terms of fold-activation) on the

Re: [R] combination of columns in a matrix

2013-06-14 Thread arun
Hi, sapply(colnames(m)[-ncol(m)],function(i) {x1-cbind(m[,i],m[,ncol(m)]); length(which(x1[,1]!=0 x1[,2]!=0))}) #A B C #2 1 2 A.K. - Original Message - From: Hermann Norpois hnorp...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Friday, June 14, 2013 3:51 PM Subject: [R]

Re: [R] significance testing for the difference in the ratio of means

2013-06-14 Thread Bert Gunter
Sigh... (Again!) These are primarily statistical, not R, issues. I would urge that you seek local statistical help. You appear to be approaching this with a good deal of semi-informed adhoc-ery. Standard methodology should be applicable, but it would be presumptuous and ill-advised of me to

Re: [R] rename and concatenate name of columns

2013-06-14 Thread David Winsemius
On Jun 14, 2013, at 1:25 PM, Bert Gunter wrote: For the record: ... A bit of commentary: Something did happen. It's just that you didn't do anything with _what_ happened. The copy of the 'dataset'-object got modified but you never returned it from the function, and and

[R] Error: cannot allocate vector of size 1.9 Gb when loading xtable help

2013-06-14 Thread Dan Keshet
I am using xtable version 1.7-1 built for R 3.0.1 on: R version 3.0.1 (2013-05-16) Platform: i686-pc-linux-gnu (32-bit) Sometimes, not every time, when I load xtable or attempt to load the help, I get an error such as this Error: cannot allocate vector of size 1.9 Gb (Stacktrace from recover()

Re: [R] significance testing for the difference in the ratio of means

2013-06-14 Thread Rahul Mahajan
My apologies if my request is off topic and for my admittedly half-baked understanding of the topic. I'm afraid trying to talk with the local statistical help, and trying to post on several general statistical forums to look for proper guidance has not yielded any response much less any helpful

Re: [R] significance testing for the difference in the ratio of means

2013-06-14 Thread Robert A LaBudde
The fact that your currents are apparently intrinsically positive and the variance increases with current plus the fact that you are interested in ratio statistics suggests that your data would benefit from an initial log transform of the data. All of your issues would then disappear, given

[R] checking certain digits of a number in a column

2013-06-14 Thread Yasin Gocgun
Hi, I need to check whether certain digits of a number, say, last five digits, appear in a column of a data frame. For instance, For example,103 in 000103 ( data [data[,3] == ...103] instead of data [data[,3] == 000103] ) or 54780 in 12354780. Can someone let me know how to do so. Thanks in

Re: [R] checking certain digits of a number in a column

2013-06-14 Thread David Winsemius
On Jun 14, 2013, at 9:33 PM, Yasin Gocgun wrote: Hi, I need to check whether certain digits of a number, say, last five digits, appear in a column of a data frame. For instance, For example,103 in 000103 ( data [data[,3] == ...103] instead of data [data[,3] == 000103] ) or 54780 in

Re: [R] checking certain digits of a number in a column

2013-06-14 Thread Rainer Schuermann
Try ?grep or library( stringr ) ?str_detect On Saturday 15 June 2013 00:33:31 Yasin Gocgun wrote: Hi, I need to check whether certain digits of a number, say, last five digits, appear in a column of a data frame. For instance, For example,103 in 000103 ( data [data[,3] == ...103]