Re: [R] how to handle NA values in aggregate()

2012-12-15 Thread arun
HI, This should also work: df1<-read.table(text=" FID  MID    IID    EW_INCU EW_17.5  EMW    EEratio 1  4621  TWF2H5    45.26    NA    15.61    NA 1  4621  TWF2H6    48.02    44.09    13.41  0.3041506 2  4630  TWF2H19  51.44  47.81    NA    NA 2 

Re: [R] how to handle NA values in aggregate()

2012-12-15 Thread arun
HI, Try this: df1<-read.table(text=" FID  MID    IID    EW_INCU EW_17.5  EMW    EEratio 1  4621  TWF2H5    45.26    NA    15.61    NA 1  4621  TWF2H6    48.02    44.09    13.41  0.3041506 2  4630  TWF2H19  51.44  47.81    NA    NA 2  4631  TWF2H21

Re: [R] Picking out certain elements in an matrix

2012-12-15 Thread Rolf Turner
On 16/12/12 18:38, Tjun Kiat Teo wrote: Suppose I have a matrix of data A 1 2 3 4 5 6 7 8 9 And I have a vector of indexes 2,1,3 For row 1 of matrix A I want the 2nd element 2 For row 2 of matrix A I want the 1st element 4 For row 3 of matrix A I want the 3rd element 9. Is there a

Re: [R] how to handle NA values in aggregate()

2012-12-15 Thread Anthony Damico
check the help file. ?aggregate says that it ignores missing values by default ;) df <- read.table( header = TRUE , text = "FID MID IID EW_INCU EW_17.5 EMWEEratio 1 4621 TWF2H545.26NA 15.61 NA 1 4621 TWF2H648.0244.09

Re: [R] Picking out certain elements in an matrix

2012-12-15 Thread David Winsemius
On Dec 15, 2012, at 9:38 PM, Tjun Kiat Teo wrote: > Suppose I have a matrix of data > > A > > 1 2 3 > 4 5 6 > 7 8 9 > > > And I have a vector of indexes 2,1,3 > > For row 1 of matrix A I want the 2nd element 2 > For row 2 of matrix A I want the 1st element 4 > For row 3 of matrix A

[R] Picking out certain elements in an matrix

2012-12-15 Thread Tjun Kiat Teo
Suppose I have a matrix of data A 1 2 3 4 5 6 7 8 9 And I have a vector of indexes 2,1,3 For row 1 of matrix A I want the 2nd element 2 For row 2 of matrix A I want the 1st element 4 For row 3 of matrix A I want the 3rd element 9. Is there a quick way to do it ? Tjun Kiat

Re: [R] troubles reading a text file

2012-12-15 Thread David Winsemius
On Dec 15, 2012, at 8:45 PM, David Winsemius wrote: > > >> >> Trying read.csv gives this: >> >> >> Error: cannot allocate vector of size 370.5 Mb > > That on the other hand suggests you have inadequate machine resources for > this job. Perhaps you should be thinking of using other tools th

Re: [R] [R-sig-Geo] averaging X of specific Y (latitude)

2012-12-15 Thread Hodgess, Erin
Hi! Is it a data frame, please? Have you tried the "table" function or "cut" function? Sincerely, Erin From: r-sig-geo-boun...@r-project.org [r-sig-geo-boun...@r-project.org] on behalf of Elaine Kuo [elaine.kuo...@gmail.com] Sent: Saturday, December 15,

Re: [R] troubles reading a text file

2012-12-15 Thread David Winsemius
On Dec 15, 2012, at 2:23 PM, wrote: > Dear R experts, > > For quite some time I have been trying to solve a mistery of reading a > seemingly trouble-free text file. The data is temperature reconstruction > arranged as a huge grid, preceded by seven "header lines" (which you see > better if f

Re: [R] troubles reading a text file

2012-12-15 Thread Jeffrey Dick
Hi Igor, It appears that the encoding is UTF-16. > readLines("temp-mon.txt") [1] "þÿ" "" "" "" "" "" "" "" "" "" "" "" "" [14] "" "" "" "" "" "" "" A search for "þÿ" leads to the Wikipedia page http://en.wikipedi

Re: [R] [R-sig-Geo] averaging X of specific Y (latitude)

2012-12-15 Thread Elaine Kuo
Hello, Yes, it is a data frame. This is the first time to hear "table" function or "cut" function. Please kindly point out how to use them. By the way, if the dataset (data frame) includes more than 2000 kinds of butterfly range sizes and the latitude of range midpoints, please kindly help with

[R] averaging X of specific Y (latitude)

2012-12-15 Thread Elaine Kuo
Hello I have a table describing butterfly range traits. It is composed of three columns as below Species name range size (X)latitude of range midpoint (Y) There are 11 kinds of butterflies. Each has its range size, and the latitude of each range midpoint ranges from 9 to 19. I woul

[R] average X value of specific Y

2012-12-15 Thread Elaine Kuo
Hello I have a table describing butterfly range traits. It is composed of three columns as below Species name range size (X)latitude of range midpoint (Y) There are 11 kinds of butterflies. Each has its range size, and the latitude of each range midpoint ranges from 9 to 19. I woul

[R] How to make a prior graph

2012-12-15 Thread Tania
Hello, could you tell me which is the command for create graphics of this prior distributions: Uniform (flat prior) Jeffrey's Thanks, Tania Sent from my iPod __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

[R] how to handle NA values in aggregate()

2012-12-15 Thread Yao He
Dear All: I am trying to calculate four columns' means in a dataframe like this: FID MID IID EW_INCU EW_17.5 EMWEEratio 1 4621 TWF2H545.26NA 15.61 NA 1 4621 TWF2H648.0244.09 13.41 0.3041506 2 4630 TWF2H19 5

Re: [R] xlim/ylim problem

2012-12-15 Thread Pascal Oettli
Hi, ylim=c(0,15000) HTH Pascal Le 12/12/16 9:14, Tom Hoffrichter a écrit : Hi everybody, just arrived at R and immediately I got a problem. Here's my script: setwd("C:/Users/Tom/Eigene Tools/Programming/R/Data") blast_hits<-read.table("blastHit_covLenght.txt", header=T) blast_hits <-

Re: [R] xlim/ylim problem

2012-12-15 Thread Greg Snow
try ylim=c(0,1500) You are missing the "c" which constructs a vector, without the "c" it gets confused. On Sat, Dec 15, 2012 at 5:14 PM, Tom Hoffrichter < tom.hoffrich...@googlemail.com> wrote: > Hi everybody, > > > > just arrived at R and immediately I got a problem. > > Here's my script: > >

[R] troubles reading a text file

2012-12-15 Thread Igor.Drobyshev2
Dear R experts, For quite some time I have been trying to solve a mistery of reading a seemingly trouble-free text file. The data is temperature reconstruction arranged as a huge grid, preceded by seven "header lines" (which you see better if file is opened in Firefox or Chrome). This is the d

[R] xlim/ylim problem

2012-12-15 Thread Tom Hoffrichter
Hi everybody, just arrived at R and immediately I got a problem. Here's my script: setwd("C:/Users/Tom/Eigene Tools/Programming/R/Data") blast_hits<-read.table("blastHit_covLenght.txt", header=T) blast_hits <- as.matrix(blast_hits) numerical1<-data.matrix(blast_hits, rownames.force = NA

[R] The R Journal, Volume 4, Issue 2

2012-12-15 Thread Martyn Plummer
Dear All, The latest issue of The R Journal is now available at http://journal.r-project.org/current.html Thanks to everyone involved. Martyn Plummer Editor-in-Chief --- This message and its attachments are strictly confidenti.

Re: [R] format.pval () and printCoefmat ()

2012-12-15 Thread arun
Hi Pradip, It this is just formatting issue, it is possible to do that with ?formatC() or ?sprintf(), but it may change those variables from numeric to character. One possibilty from `res`: res<-data.frame(dat1[,1:2],read.table(text=Lines2,header=TRUE)) varsNum<-sapply(res,is.numeric) res[varsNu

[R] Single node in tree

2012-12-15 Thread Robin Davies
Hi there, I'm new to R and need some help. I have a dataset of 30,000 records with a response (1/0) indicator resulting in a response rate of 29%. I have 1 categorical predictor variable (gender - M/F) and two continuous variables ("score" and age). When I create an rpart model, I only get one

Re: [R] How to limit string size when displaying data frames?

2012-12-15 Thread David L Carlson
In creating that function, you may want to skip numeric fields so they do not get trimmed: > trimstr <- function(x, len=10) { if (is.numeric(x)) +x else substr(x, 1, len) + } > x c1 c2 1 -0.1674062 ABCDEFGHIJKLMNOPQRSTUVWXYZ 2 2.1589942 ABCDEFGHIJKLMNOPQRSTUV

Re: [R] How to limit string size when displaying data frames?

2012-12-15 Thread Mauricio Cornejo
David ... thank you. OK ... so it appears there's no direct way to do this.  But I could write a function for printing data frames that would utilize your suggested approach, data.frame(lapply()).  This way, I could simply call the function with the data frame object as the argument. Thanks a

Re: [R] How to speed up the for loop by releasing memeory

2012-12-15 Thread Patrick Burns
You are in Circle 2 of 'The R Inferno'. You are wise to want to leave. http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Pat On 15/12/2012 15:10, Yong Wang wrote: Dear list; How can I speed up the run of following code (illustrative) #===

[R] Problem when plotting

2012-12-15 Thread Robert A'gata
Hi, I was trying to call chart.Posn. I ran into an unusual problem. It complains that: Error in strheight(axt): X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*..., face 1 at size 11 could not be loaded. I am wondering how to fix this? It seems something is missing from X11 device but I don't k

Re: [R] format.pval () and printCoefmat ()

2012-12-15 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hi Arun, Thank you so much for further clarifications and help. Pradip Pradip K. Muhuri, PhD Statistician Substance Abuse & Mental Health Services Administration The Center for Behavioral Health Statistics and Quality Division of Population Surveys 1 Choke Cherry Road, Room 2-1071 Rockville, MD

Re: [R] Installing Packages from a Local Repository

2012-12-15 Thread Prof Brian Ripley
On 15/12/2012 17:36, Uwe Ligges wrote: You have to specify the repository as "file:Q:/Integrated Planning/R" (and I am not entirely sure if blanks are supported). Actually, that's not right: see ?url. All URI schemes start like file:// . For Windows the help says In this form the pat

Re: [R] Installing Packages from a Local Repository

2012-12-15 Thread Uwe Ligges
You have to specify the repository as "file:Q:/Integrated Planning/R" (and I am not entirely sure if blanks are supported). Best, Uwe Ligges On 13.12.2012 11:52, Tommy O'Dell wrote: Hi everyone, I've followed the instructions from R-Admin Section 6.6 for creating a local repository. I've m

[R] how to run MCMC with binomial distribution

2012-12-15 Thread Tania Patiño
Hello, could you tell me how to run a MCMC with binomial distribution? If there is an example will be nice to know about it. Thanks, Tania [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] How to limit string size when displaying data frames?

2012-12-15 Thread David Winsemius
On Dec 15, 2012, at 8:27 AM, Mauricio Cornejo wrote: > Hello, > > Is there a way to set the maximum width of character columns when printing a > data frame? > > I've looked into print(), format(), and options() and have been unsuccessful. > > For example, I'd like to achieve the results below

Re: [R] How to speed up the for loop by releasing memeory

2012-12-15 Thread Duncan Murdoch
On 12-12-15 10:10 AM, Yong Wang wrote: Dear list; How can I speed up the run of following code (illustrative) # con<-vector("numeric") for (i in 1:limit) { if(matched data for the ith item found) { if(i==1) {co

[R] How to limit string size when displaying data frames?

2012-12-15 Thread Mauricio Cornejo
Hello, Is there a way to set the maximum width of character columns when printing a data frame? I've looked into print(), format(), and options() and have been unsuccessful. For example, I'd like to achieve the results below without having to modify the data itself. > x <- data.frame(c1=rno

Re: [R] How to speed up the for loop by releasing memeory

2012-12-15 Thread Jeff Newmiller
Please read the posting guide. You need to provide reproducible code (please simplify, but make sure it illustrates your problem and runs) to communicate clearly what problem you are trying to solve. Chances are good that you don't need any for loop at all, but without running code we can't tel

Re: [R] format.pval () and printCoefmat ()

2012-12-15 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Dear Arun and David, I am so grateful to you for all your help with the code. Thanks and regards, Pradip Arun - All this is very helpful. In general, I can follow the code. I only have the following questions: What changes in the code would be required to have 3 places after decimal for

[R] How to speed up the for loop by releasing memeory

2012-12-15 Thread Yong Wang
Dear list; How can I speed up the run of following code (illustrative) # con<-vector("numeric") for (i in 1:limit) { if(matched data for the ith item found) { if(i==1) {con<-RowOfMatchedData } else {con<-rbind(con

Re: [R] kruskalmc, significant differences while median values are the same

2012-12-15 Thread Pascal Oettli
Hello, What about the median ranks? This test is based on ranks. Regards, Pascal Le 12/12/15 18:04, Omphalodes Verna a écrit : Dear list! I work with multiple Kruskal-Wallis test (kruskalmc, package pgirmess), which evaluates differences in medians among groups (5 groups). A result of a tes

[R] kruskalmc, significant differences while median values are the same

2012-12-15 Thread Omphalodes Verna
Dear list! I work with multiple Kruskal-Wallis test (kruskalmc, package pgirmess), which evaluates differences in medians among groups (5 groups). A result of a test is significant differences among some groups, while median values are the same for 4 groups (using tapply). Why? p.s.: number of

[R] interfacing with .Call

2012-12-15 Thread Shangru Li
Hi My code is as following: #include #include //* the Projector part *// void Projector(double *L, int *dimL, double *G, int *dimG, double *W, int *dimW, int *xymod, int *dimxy, double *modif, int *dimif, double *Lsum) { ...} //* the interface part *// #define getDim(A) INTEGER(coerceVector(