Re: [R] Putting a text box in a plot

2009-09-21 Thread Sergey Goriatchev
Hello, Jim Thank you a lot for suggestions, I will check that package out. It could be the one I used way back then! :-) Best, Sergey On Tue, Sep 22, 2009 at 01:55, Jim Lemon wrote: > On 09/21/2009 07:42 PM, Sergey Goriatchev wrote: >> >> Hello everyone, >> >> I have a plot and I want to but a

Re: [R] Quadratic Constraints

2009-09-21 Thread vikrant S
Thanks Hans for ur help I will try to solve the problem accordingly if there are any problems will contact u surely . -- View this message in context: http://www.nabble.com/Quadratic-Constraints-tp25528480p25530553.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Pull Coefficients from MCMCpack models

2009-09-21 Thread Debabrata Midya
Try this: apply(foo, 2, mean) or apply(foo, 2, median) Thanks, Deb >>> Noah Silverman 22/09/2009 12:34 pm >>> Hi, I've been testing some models with the MCMCpack library. I can run the process and get a nice model "object". I can easily see the summary and even plot it. I can't seem

[R] cox memory

2009-09-21 Thread Λεωνίδας Μπαντής
Hi there, I have a rather large data set and perform the following cox model: test1 <- list(tstart,tstop,death1,chemo1,radio1,horm1) out1<-coxph( Surv(tstart,tstop, death1) ~ chemo1+chemo1:log(tstop+1)+horm1+horm1:log(tstop+1)+age1+grade1+grade1:log(tstop+1)+positive1+positive1:log(tstop+1)+si

Re: [R] Point Density calculation

2009-09-21 Thread claw73
Sorry for the confusion about my question. Here is the actual data I want to analyze: Test Data: 45 40 42.11 N 111 02 32.79 W 5 45 40 31.30 N 111 02 32.55 W 5 45 40 38.29 N 111 02 52.81 W 5 45 40 45.90 N 111 03 25.57 W 5 45 42 52.26 N 110 58 26.36 W 10 45.43 20.60 N 110 58 05.19 W 15

[R] Plotting waver files

2009-09-21 Thread blahbleh
Is there a good tutorial or just sample code on how to plot .wav files in R? I would really appreciate it! -- View this message in context: http://www.nabble.com/Plotting-waver-files-tp25530418p25530418.html Sent from the R help mailing list archive at Nabble.com.

[R] Linear Model "NA" Value Test

2009-09-21 Thread dmhultst
Hello, I am deriving near real-time liner relationships based on 5-min precipitation data, sometimes the non-qced data result in a slope of NA. I am trying to read the coefficient (in this example x) to see if it is equal to NA, if it is equal to NA assign it a value of 1. I am having trouble w

[R] Problem while using KLdiv()

2009-09-21 Thread Robert Hall
I am receiving the following error while executing KLdiv method: kl<-KLdiv(y) Error in function (classes, fdef, mtable) : unable to find an inherited method for function "KLdiv", for signature "data.frame" the code is as follows: require(flexmix) KLdiv(y) I tried searching in the R mail archi

Re: [R] Pull Coefficients from MCMCpack models

2009-09-21 Thread Debabrata Midya
Try this: First of all: > predict(foo) Error in UseMethod("predict") : no applicable method for "predict" Therefore, an alternative approach may be taken: As per: bar <- apply(foo,2,mean) bar[1] is the intercept bar[2] is the coefficient for x1 bar[2] is the coefficient for x2 Th

Re: [R] Problem at subsetting matrix by using dimnames

2009-09-21 Thread Agustin Lobo
Thanks a lot. Based on your suggestions, would the following diag(mitest[c("a", "b", "c"), c("b", "c", "b")]) work in general? (it does for my example). If so, I would prefer this form as I understand it better. Agus Henrique Dallazuanna wrote: Try this: mapply(function(x, y)mitest[x, y], c

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread Gabor Grothendieck
Also you have to be very careful. e.g. > BOD Time demand 118.3 22 10.3 33 19.0 44 16.0 55 15.6 67 19.8 > attach(BOD) > Time <- Time + 1 > BOD # oops! BOD was not changed Time demand 118.3 22 10.3 33 19.0 44 16.0 55 15.6 6

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread hadley wickham
>> From: hadley wickham >> >> Don't use attach? > > Obvously good advice but why? Philosophically, it's better to be explicit than implicit, and the extremely non-local effects of attach can make debugging difficult. Hadley -- http://had.co.nz/ __

Re: [R] Pull Coefficients from MCMCpack models

2009-09-21 Thread Noah Silverman
Deb, That's great!!! But, then how to I convert those values to a "model" so I can use a "predict" function. I can see: bar <- apply(foo,2,mean) That creates an object, "bar", with the coefficients. But, I can't call predict on bar... -N On 9/21/09 7:58 PM, Debabrata Midya wrote: > Try t

Re: [R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread David Winsemius
Read Gabor's advice more closely: Especially unlucky "#" (hint, hint) 13. On Sep 21, 2009, at 11:08 PM, Peng Yu wrote: Here are the outputs. strsplit(scanned_file[5205],'\t')[[1]] [1] "6836237" [2] "8.146431" [3] "8.197432" [4] "8.156005" [5] "7.98905" [6] "8.327593" [7] "7.673796" [8] "8

Re: [R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread Gabor Grothendieck
It has a # in it as I previously suggested. On Mon, Sep 21, 2009 at 11:08 PM, Peng Yu wrote: > Here are the outputs. > >> strsplit(scanned_file[5205],'\t')[[1]] >  [1] "6836237" >  [2] "8.146431" >  [3] "8.197432" >  [4] "8.156005" >  [5] "7.98905" >  [6] "8.327593" >  [7] "7.673796" >  [8] "8.11

Re: [R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread Peng Yu
Here are the outputs. > strsplit(scanned_file[5205],'\t')[[1]] [1] "6836237" [2] "8.146431" [3] "8.197432" [4] "8.156005" [5] "7.98905" [6] "8.327593" [7] "7.673796" [8] "8.119687" [9] "8.077252" [10] "Asap1 " [11] "NM_010026 " [12] "RefSeq " [13] "Mus musculus ArfGAP with SH# domain, ank

[R] Pull Coefficients from MCMCpack models

2009-09-21 Thread Noah Silverman
Hi, I've been testing some models with the MCMCpack library. I can run the process and get a nice model "object". I can easily see the summary and even plot it. I can't seem to figure out how to: 1) Access the final coefficients in the model 2) Turn the coefficients into a model so I can the

Re: [R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread Gabor Grothendieck
Its highly unusual to use xls as the extension for a text file. Use something more suggestive. print out the line in question. For example, note that scan and read.table have different defaults for the comment character, namely, none and #. On Mon, Sep 21, 2009 at 10:23 PM, Peng Yu wrote: > On

Re: [R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread Peng Yu
On Mon, Sep 21, 2009 at 9:12 PM, Peng Yu wrote: > Hi, > > I have the following commands. It says line 5205 does not have 22 > elements. But I use my 'vim' checked that line in the file. It has 22 > fields. Can somebody let me know how to further debug this case? > > Regards, > Peng > >> annotation

[R] Weird read.table error? (line `n' did not have `m' elements)

2009-09-21 Thread Peng Yu
Hi, I have the following commands. It says line 5205 does not have 22 elements. But I use my 'vim' checked that line in the file. It has 22 fields. Can somebody let me know how to further debug this case? Regards, Peng > annotation = read.table("../EC_results/Juan_15wks_gene_core.xls", header=T,

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread RICHARD M. HEIBERGER
If you are starting with an Excel file, then you should have R read the xls file directly. You should avoid the distortions often introduced by an intermediate format such as .txt or .csv files. I recommend using RExcel. You can get it from CRAN with install.packages("RExcelInstaller") library(R

Re: [R] xtable - print - suppress output

2009-09-21 Thread Gabor Grothendieck
Note that R has a capture.output function, e.g. s <- capture.output(print(xtable(BOD), type = "html")) On Mon, Sep 21, 2009 at 9:21 PM, Charlie Sharpsteen wrote: > On Mon, Sep 21, 2009 at 3:52 PM, Don MacQueen wrote: > > snip... > > >> In other words, there is no such thing as saving the html

[R] AIC vs. extractAIC

2009-09-21 Thread Steve Hong
Dear list, I am confused about two functions in R: AIC(fm) and extractAIC(fm). What is the difference between two and when do I have to use one over the other? I have found the similar question previously and still not clear for me to understand. I also looked at '?AIC' and '?extractAIC' in R,

Re: [R] xtable - print - suppress output

2009-09-21 Thread Charlie Sharpsteen
On Mon, Sep 21, 2009 at 3:52 PM, Don MacQueen wrote: snip... > In other words, there is no such thing as saving the html table into a > variable. It just doesn't work that way. All that is possible is to write it > (print it) to either the screen or a file. > > Which leads back to the question

Re: [R] Printing column names before each block of output (fwd)

2009-09-21 Thread Jim Lemon
On 09/21/2009 11:32 PM, A Singh wrote: Dear All, I need to print the column names of variables before each block of output, for a nested model with 2 levels (3 phenotypes * 10 markers). This is so that my output is labeled, and I know which combination of factors produces which set of REML es

Re: [R] Putting a text box in a plot

2009-09-21 Thread Jim Lemon
On 09/21/2009 07:42 PM, Sergey Goriatchev wrote: Hello everyone, I have a plot and I want to but a (formatted) box containing text and numbers, say: Mean: 0.1 St.Deviation: 1.1 Skewness: 1.1 Kurtosis: 0.5 I know there is a way to do this, there is a function in some library, but it's been years

Re: [R] Selecting data based on date-Data manupulation

2009-09-21 Thread Jim Lemon
On 09/21/2009 03:55 PM, premmad wrote: I have 70 columns and more than 400k rows .In the data date column will have values from 1900(01/01/1900) .How do i select only the data of recent two years?Help me in this regard Hi premmad, First, find out what the two most recent dates are: two_rece

Re: [R] Read-in TSV file

2009-09-21 Thread Jim Porzak
Andy, If "TSV" = tab separated file, then ?read.delim HTH, Jim Porzak Ancestry.com San Francisco, CA www.linkedin.com/in/jimporzak use R! Group SF: www.meetup.com/R-Users/ On Mon, Sep 21, 2009 at 4:00 PM, Andrew Wang wrote: > Is there a standard command that I can use to read a TSV file into

Re: [R] logarithmic seq() ?

2009-09-21 Thread Oliver Bandel
manchester.ac.uk> writes: > > On 21-Sep-09 18:47:50, Oliver Bandel wrote: > > Hello, > > in scilab /Matlab there are functions that can create linear > > sequences (like R's seq()) as well as logarithmic sequences. > > > > > > Is there a logarithmic aequivalent of seq()? > > Or maybe this wou

Re: [R] problems with Stackpoly, package Plotrix

2009-09-21 Thread Jim Lemon
On 09/21/2009 09:31 AM, Václav Varvařovský wrote: xpopis<-c(0.9,0.99,0.999) paste("1 in",round(1/(1-xpopis),1),sep=" ") #n as number of subjects is 4 result<-c(0.3,0.15,0.4,0.15,0.5,0.1,0.12,0.28,0.45,0.25,0.2,0.1) stackpoly(x=matrix(nrow=3,ncol=4,xpopis),y=matrix(nrow=3,ncol=4,result,byrow=T),

[R] Read-in TSV file

2009-09-21 Thread Andrew Wang
Is there a standard command that I can use to read a TSV file into R? Thanks Andy __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provid

Re: [R] RODBC : using and passing queries that use " in some arguments

2009-09-21 Thread Don MacQueen
Start by using single quotes in your paste() command. dumb example: sql <- paste(' select x = "3" ') (the query is nonsense, I just wrote it to show how to get double quotes into the query) -Don At 6:45 PM +0200 9/21/09, BOISSON, Pascal wrote: Dear R users, I am trying to connect R to da

Re: [R] xtable - print - suppress output

2009-09-21 Thread Don MacQueen
I think there is a conceptual issue here. The xtable() function does not actually create html. What it does is add some attributes to the dataframe that is given to it. Here's an example: tmp <- data.frame( a =1:3, b= c('a','b','c') ) foo <- xtable(tmp) class(foo) [1] "xtable" "da

Re: [R] xtable - print - suppress output

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 6:13 PM, Martin Batholdy wrote: Am 21.09.2009 um 23:59 schrieb Rolf Turner: On 22/09/2009, at 9:52 AM, Martin Batholdy wrote: I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just w

Re: [R] xtable - print - suppress output

2009-09-21 Thread Rolf Turner
On 22/09/2009, at 10:13 AM, Martin Batholdy wrote: Am 21.09.2009 um 23:59 schrieb Rolf Turner: On 22/09/2009, at 9:52 AM, Martin Batholdy wrote: hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just

Re: [R] xtable - print - suppress output

2009-09-21 Thread Martin Batholdy
Am 21.09.2009 um 23:59 schrieb Rolf Turner: On 22/09/2009, at 9:52 AM, Martin Batholdy wrote: hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable; tabl

Re: [R] problems with Stackpoly, package Plotrix

2009-09-21 Thread Jim Lemon
On 09/21/2009 09:15 AM, Václav Varvařovský wrote: Dear all, I am fairly new to package Plotrix and I would like to ask you, if any of you could help me with following. a) I don't know how to set up border line width in the Stackpoly function (seems that lwd from par doesn't work, or at least no

Re: [R] xtable - print - suppress output

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 5:52 PM, Martin Batholdy wrote: I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable; table <- print(xtable(CERAT), type="html") How can I supp

Re: [R] xtable - print - suppress output

2009-09-21 Thread Rolf Turner
On 22/09/2009, at 9:52 AM, Martin Batholdy wrote: hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable; table <- print(xtable(CERAT), type="html") How can I

[R] xtable - print - suppress output

2009-09-21 Thread Martin Batholdy
hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable; table <- print(xtable(CERAT), type="html") How can I suppress that output is printed? thanks!

Re: [R] correlation help

2009-09-21 Thread Liviu Andronic
On 9/21/09, William Revelle wrote: > correlations) use either the rcorr function in the Hmisc package or the > corr.test function in the psych package. > Also, check the graphical interfaces in Rcmdr and Deducer. Liviu __ R-help@r-project.org mailing l

Re: [R] Linear Model "NA" Value Test

2009-09-21 Thread Ted Harding
On 21-Sep-09 20:38:25, Douglas M. Hultstrand wrote: > Hello, > > I am deriving near real-time liner relationships based on 5-min > precipitation data, sometimes the non-qced data result in a > slope of NA. I am trying to read the coefficient (in this example x) > to see if it is equal to NA, if it

Re: [R] correlation help

2009-09-21 Thread John Kane
library(psych) corr.test(d6) ? --- On Sun, 9/20/09, Adrian Johnson wrote: > From: Adrian Johnson > Subject: Re: [R] correlation help > To: r-help@r-project.org > Received: Sunday, September 20, 2009, 6:19 PM > thank you john. > however, I am finding it difficult to automate on a > matrix.

Re: [R] Linear Model "NA" Value Test

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 4:50 PM, David Winsemius wrote: On Sep 21, 2009, at 4:38 PM, Douglas M. Hultstrand wrote: Hello, I am deriving near real-time liner relationships based on 5-min precipitation data, sometimes the non-qced data result in a slope of NA. I am trying to read the coefficien

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread A Singh
Thanks a huge bunch John, David, Steve, Hadley and Erik! I don't know how acceptable it is to mass thank everyone :), but seemed like a good idea as everyone was in on the thread and here's how it worked: Unmatched quotes was probably correct. When exporting from excel, it did warn me that the

[R] RWeb javascript version

2009-09-21 Thread Natalie O'Toole
Hi, Does the general public have access to RWeb at the following URL: http://www.math.montana.edu/Rweb/codeWindow.html Or do we need a special username and password? If so, how do I go about obtaining that username and password, please? Cheers, Natalie Natalie O'Toole Data Information Special

Re: [R] Linear Model "NA" Value Test

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 4:38 PM, Douglas M. Hultstrand wrote: Hello, I am deriving near real-time liner relationships based on 5-min precipitation data, sometimes the non-qced data result in a slope of NA. I am trying to read the coefficient (in this example x) to see if it is equal to NA, if

Re: [R] Linear Model "NA" Value Test

2009-09-21 Thread Erik Iverson
> if("fit$coef[[2]]" == "NA") {.cw = 1} See ?is.na __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-conta

[R] Linear Model "NA" Value Test

2009-09-21 Thread Douglas M. Hultstrand
Hello, I am deriving near real-time liner relationships based on 5-min precipitation data, sometimes the non-qced data result in a slope of NA. I am trying to read the coefficient (in this example x) to see if it is equal to NA, if it is equal to NA assign it a value of 1. I am having trouble w

Re: [R] Handling missing data

2009-09-21 Thread Vassilis Golfinopoulos
No, this is part of my dataset. Anyway, this is unlikely to cause the problem. If there are few data, impute.knn actually uses mean imputation (and returns a warning). - Original Message - From: "Martin Morgan" To: "Vassilis Golfinopoulos" Cc: "Greg Snow" ; ; "premmad" Sent: Mond

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread John Kane
--- On Mon, 9/21/09, hadley wickham wrote: > From: hadley wickham > > Don't use attach? Obvously good advice but why? __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread John Kane
Sometimes getting a file into R can seem like the longest part of the project :( Okay I seem to have misread your first message. If I understand you correctly the file vcl is being read in? It is only when you try to attach the file that you have the problem? If this is so, have a look at vc

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread David Winsemius
Read in the first few lines with readLines, try to "eyeball" the errors and if not successful, then supply them to read.table through a textConnection. Remember that single quotes do not match double quotes. Also watch out for "smart-quotes". I don't think they match anything. ?readLines

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread hadley wickham
On Mon, Sep 21, 2009 at 3:04 PM, A Singh wrote: > Dear R users, > > I am trying to read in a file with 105 columns, and when trying to attach > it, get an error as follows: > >> vc1<-read.table("P:\\R\\Everything-I.txt", header=T, sep=" ", dec=".", > > na.strings=NA, strip.white=T) >> >> attach(vc

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread Erik Iverson
> I did just try to do that, and it is still returning the same error when I > try to attach the csv file.. > > > vc1<-read.table("P:\\R\\Everything-I.csv",header=T, sep=" ", dec=".", > na.strings=NA, strip.white=T) > > attach(vc1) > Error in attach(vc1) : variable names are limited to 256 bytes

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread Steve Lianoglou
Hi Aditi, On Sep 21, 2009, at 4:04 PM, A Singh wrote: Dear R users, I am trying to read in a file with 105 columns, and when trying to attach it, get an error as follows: vc1<-read.table("P:\\R\\Everything-I.txt", header=T, sep=" ", dec=".", na.strings=NA, strip.white=T) attach(vc1) E

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread A Singh
:) Well that does make even more sense. Is there a way of fixing the unmatched quote problem though? I do not have any clue as to how it can be done. Will remaking the original file, and then re-reading it in help? --On 21 September 2009 16:17 -0400 David Winsemius wrote: On Sep 21, 200

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread A Singh
Dear John, I did just try to do that, and it is still returning the same error when I try to attach the csv file.. vc1<-read.table("P:\\R\\Everything-I.csv",header=T, sep=" ", dec=".", na.strings=NA, strip.white=T) attach(vc1) Error in attach(vc1) : variable names are limited to 256 bytes

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 4:04 PM, A Singh wrote: Dear R users, I am trying to read in a file with 105 columns, and when trying to attach it, get an error as follows: vc1<-read.table("P:\\R\\Everything-I.txt", header=T, sep=" ", dec=".", na.strings=NA, strip.white=T) attach(vc1) Error in at

Re: [R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread John Kane
Well the first suspicious thing seems to be the 256 byte variable names. Do you really have a 256 byte variable name? If so, why? It sounds like R is reading the entire header line as one variable. Why not try exporting the Exce file as a csv file and loading that? --- On Mon, 9/21/09,

[R] Working around 256 byte variable names? + trouble opening large file

2009-09-21 Thread A Singh
Dear R users, I am trying to read in a file with 105 columns, and when trying to attach it, get an error as follows: vc1<-read.table("P:\\R\\Everything-I.txt", header=T, sep=" ", dec=".", na.strings=NA, strip.white=T) attach(vc1) Error in attach(vc1) : variable names are limited to 256 byt

Re: [R] Regarding information on writing R scripts

2009-09-21 Thread Patrick Connolly
On Mon, 21-Sep-2009 at 11:34PM +0530, Manuj Sharma wrote: |> I need to run a set of R commands in batch mode. Can somebody |> please provide pointers to information on how to write R scripts to |> execute commands in batch mode? ?BATCH |> Thanks, |> |> Manuj |> |> |> |> Try the new Y

Re: [R] logarithmic seq() ?

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 2:47 PM, Oliver Bandel wrote: Hello, in scilab /Matlab there are functions that can create linear sequences (like R's seq()) as well as logarithmic sequences. Is there a logarithmic aequivalent of seq()? Or maybe this would be an idea for newer R-releases, maybe a typ

Re: [R] logarithmic seq() ?

2009-09-21 Thread Ted Harding
On 21-Sep-09 18:47:50, Oliver Bandel wrote: > Hello, > in scilab /Matlab there are functions that can create linear > sequences (like R's seq()) as well as logarithmic sequences. > > > Is there a logarithmic aequivalent of seq()? > Or maybe this would be an idea for newer R-releases, > maybe a ty

Re: [R] More elegant way of excluding rows with equal values in any 2columns?

2009-09-21 Thread William Dunlap
Assuming your real dataset isn't the one you showed (for which e1071::permutation(4) works well) you can sort each row and then quickly check for duplicates by comparing each column to the previous column. E.g., f <- function(index){ rowSort <- function(x){ x <- t(as.matrix(x)) x[]

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Dimitri Liakhovitski
Thanks a lot everyone - it's been extremely helpful! Dimitri On Mon, Sep 21, 2009 at 3:16 PM, Jorge Ivan Velez wrote: > > Hi Dimitri, > Try also either > index[apply(index, 1, function( x ) length( unique( x ) ) == 4 ),] > or > # install.packages('e1071') > require(e1071) > permutations(4) > HTH,

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Jorge Ivan Velez
Hi Dimitri, Try also either index[apply(index, 1, function( x ) length( unique( x ) ) == 4 ),] or # install.packages('e1071') require(e1071) permutations(4) HTH, Jorge On Mon, Sep 21, 2009 at 2:14 PM, Dimitri Liakhovitski <> wrote: > Hello, dear R-ers! > > I built a data frame "grid" (below)

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Erik Iverson
> > You could also replace "!duplicated" in my function with "unique" ... > It turns out you can't, of course :). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.o

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 2:14 PM, Dimitri Liakhovitski wrote: Hello, dear R-ers! I built a data frame "grid" (below) with 4 columns. I want to exclude all rows that have equal values in ANY 2 columns. Here is how I am doing it: index<-expand.grid(1:4,1:4,1:4,1:4) dim(index) # Deleting rows that ha

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Erik Iverson
It probably does... I did not look at his until just now, my guess is they are equivalent. There are usually at least a couple ways to do things in R, no problem :). With massive datasets, it might make sense to try a couple different ways to see if one or the other is faster though. You co

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Dimitri Liakhovitski
Thank you very much, both Dimitris and Erik. Erik - you are right, I was trying to remove any duplication (i.e., if there are the same values in 2 or 3 or 4 columns). And it looks like that's what your solution does. But doesn't it do the same thing as Dimitris' solution? Dimitri On Mon, Sep 21,

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Erik Iverson
Hello, Do you mean exactly any 2 columns. What if the value is equal in more than 2 columns? > > I built a data frame "grid" (below) with 4 columns. I want to exclude > all rows that have equal values in ANY 2 columns. Here is how I am > doing it: > > index<-expand.grid(1:4,1:4,1:4,1:4) If

[R] logarithmic seq() ?

2009-09-21 Thread Oliver Bandel
Hello, in scilab /Matlab there are functions that can create linear sequences (like R's seq()) as well as logarithmic sequences. Is there a logarithmic aequivalent of seq()? Or maybe this would be an idea for newer R-releases, maybe a type-option with "linear" and "logarithmic" as parameters...

Re: [R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Dimitris Rizopoulos
one way is the following: index <- expand.grid(1:4, 1:4, 1:4, 1:4) mat <- data.matrix(index) keep <- apply(mat, 1, function (x, d) length(unique(x)) == d, d = ncol(mat)) index[keep, ] I hope it helps. Best, Dimitris Dimitri Liakhovitski wrote: Hello, dear R-ers! I built a data frame "

Re: [R] missing level of a nested factor results in an NA in lm output

2009-09-21 Thread Timothy Clough
I should have specified this before - it's part of the gmodels library. On Sep 21, 2009, at 2:31 PM, Erik Iverson wrote: estimable(fit, myEstimate) Estimate Std. Error t value DF Pr(>|t|) test 12.18198 0.6694812 18.19615 10 5.395944e-09 Where are you getting this "estimable" functi

Re: [R] missing level of a nested factor results in an NA in lm output

2009-09-21 Thread Erik Iverson
> > estimable(fit, myEstimate) > Estimate Std. Error t value DF Pr(>|t|) > test 12.18198 0.6694812 18.19615 10 5.395944e-09 Where are you getting this "estimable" function from? A package? Did you define it yourself? __ R-help@r-project

[R] missing level of a nested factor results in an NA in lm output

2009-09-21 Thread Timothy Clough
Dear All, I have posted to this list before regarding the same issue so I apologize for the multiple e-mails. I am still struggling with this issue so I thought I'd give it another try. This time I have included reproducible code and a subset of the data I am analyzing. I am running an

[R] More elegant way of excluding rows with equal values in any 2 columns?

2009-09-21 Thread Dimitri Liakhovitski
Hello, dear R-ers! I built a data frame "grid" (below) with 4 columns. I want to exclude all rows that have equal values in ANY 2 columns. Here is how I am doing it: index<-expand.grid(1:4,1:4,1:4,1:4) dim(index) # Deleting rows that have identical values in any two columns (1 line of code): inde

Re: [R] weird "vector size cannot be NA/NaN" problem

2009-09-21 Thread Peter Ehlers
Good spot Bill, and the error message comes from tabulate(). Peter Ehlers William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Ehlers Sent: Monday, September 21, 2009 9:29 AM To: Werner Wernersen Cc: r-h.

[R] Regarding information on writing R scripts

2009-09-21 Thread Manuj Sharma
I need to run a set of R commands in batch mode. Can somebody please provide pointers to information on how to write R scripts to execute commands in batch mode? Thanks, Manuj Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew [[alternative HTML version d

Re: [R] RODBC : using and passing queries that use " in some arguments

2009-09-21 Thread BOISSON, Pascal
Dear R users, I am trying to connect R to data that is in a Access Database but I have problem with the construction of queries using special characters. I am using RODBC package. The following is working : > MyQuery<-paste("SELECT first( (DateHeure) ) , avg(NNO3_AT322_OUT_moy) AS Cond > FR

Re: [R] weird "vector size cannot be NA/NaN" problem

2009-09-21 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Ehlers > Sent: Monday, September 21, 2009 9:29 AM > To: Werner Wernersen > Cc: r-h...@stat.math.ethz.ch > Subject: Re: [R] weird "vector size cannot be NA/NaN" problem > >

Re: [R] truth (karnaugh) table

2009-09-21 Thread baptiste auguie
I knew I was missing the obvious. And to think it's only Monday... Thanks everyone! baptiste 2009/9/21 Henrique Dallazuanna : > Try this: > > do.call(expand.grid, rep(list(0:1), 4)) > > On Mon, Sep 21, 2009 at 2:04 PM, baptiste auguie > wrote: >> Dear list, >> >> I think I'm being dense, but I

[R] truth (karnaugh) table

2009-09-21 Thread baptiste auguie
Dear list, I think I'm being dense, but I can't get combn or expand.grid to give me this result. I need to generate a matrix of all 16 possible sequences of 4 boolean elements, 0001 0010 0011 0100 . (in the end I'll have to assign NA to the 0s and some value to the 1s but let's kee

Re: [R] Handling missing data

2009-09-21 Thread Martin Morgan
Vassilis Golfinopoulos wrote: > Consider this sample dataset (displayed [1:3, 1:3]): > > T1053B T1102A T1129A > AKT1 -0.02412174 0.1986057 NA > AURKA -0.37109748 -0.4418542 0.04967051 > BRAF -0.14589269 -0.1590310 -0.35483226 > >> is.na(dataset[1, 3]) > TRUE > > l

Re: [R] truth (karnaugh) table

2009-09-21 Thread Henrique Dallazuanna
Try this: do.call(expand.grid, rep(list(0:1), 4)) On Mon, Sep 21, 2009 at 2:04 PM, baptiste auguie wrote: > Dear list, > > I think I'm being dense, but I can't get combn or expand.grid to give > me this result. I need to generate a matrix of all 16 possible > sequences of 4 boolean elements, > >

Re: [R] plotmath

2009-09-21 Thread Uwe Ligges
baptiste auguie wrote: plot(0, xlab=bquote(theta *" = "* .(x))) or probably easier use == as in plot(0, xlab=bquote(theta == .(x))) Uwe Ligges ?substitute ?bquote HTH, baptiste 2009/9/21 Jarrod Hadfield : Hi, I want to have a legend that is a mixture of numbers and symbols, and have

Re: [R] Problem in Installing packages in R 2.9.2

2009-09-21 Thread Gabor Grothendieck
The first warning is just telling you which library its going to use. Unless you didn't want to use that library its of no concern. The second warning is a permissions problem with updating the help files. Try running R as Administrator (or install R into your user area). On Mon, Sep 21, 2009 a

[R] Problem in Installing packages in R 2.9.2

2009-09-21 Thread mohsin ali
Hi Sir When I use install.packages("cvt') for installing packages using R 2.9.2 I have the following problem > install.packages("ctv") Warning in install.packages("ctv") : argument 'lib' is missing: using 'C:\Users\Amina\Documents/R/win-library/2.9' --- Please select a CRAN mirror for u

Re: [R] weird "vector size cannot be NA/NaN" problem

2009-09-21 Thread Peter Ehlers
Werner, Thanks for sending the data. The problem does seem to lie with describe() in pkg:Hmisc. Frank may want to know that it can be triggered by f <- function(n)describe(c(1:n,1/0)) f(18) #ok f(19) #triggers the error Perhaps it's related to the "at least 20 unique values" condition menti

Re: [R] how to count occurrences of string?

2009-09-21 Thread Stefan Th. Gries
This should do what you want: set.seed(1) # cerating a vector with comments, in which d's will be counted comments<-character(25) for (i in 1:25) { comments[i] <- paste(sample(letters[1:10], 10, replace=T), collapse="") } # creating a vector to cross -tabulate age <-sample(c("old", "young"), 2

[R] DF-GLS optimal lags

2009-09-21 Thread Karla hernández
I want to used the funtion ur.ers (DF-GLS unit root test) from the urca packet, but there is not a test which give me the optimal lags in the posibilities of the packet. I am interested in know if there is a program to calculed this optimal lag, or if someone know which one is the maximal criterium

Re: [R] How to use nls when [selfStart] function returns NA or Inf??

2009-09-21 Thread Gabor Grothendieck
With a small number of parameters just use brute force on grid to calculate starting values. See nls2 package. On Mon, Sep 21, 2009 at 12:17 PM, Keith Jewell wrote: > Hi Everyone, > > I posted this a couple of weeks ago with no responses. My interface (via > gmane) seemed a bit flakey at the tim

[R] Error in make.names when trying to read.table in if statement

2009-09-21 Thread Cynthia Sadler
Hi, I'm trying to read data from a collection of CSV files for processing and graphing. All of my files begin with "modrate" and end with ".csv". I think I have the regex working but I am stumped at trying to get read.table to work within an if statement. This works: > filepattern="modra

[R] How to use nls when [selfStart] function returns NA or Inf??

2009-09-21 Thread Keith Jewell
Hi Everyone, I posted this a couple of weeks ago with no responses. My interface (via gmane) seemed a bit flakey at the time, so I'm venturing to repost with some additional information. I'm trying to write selfStart non-linear models for use with nls. In these models some combinations of para

[R] Nested test

2009-09-21 Thread chatcrawler
Dear R users. I am analysing a parasite-host dataset which consists of the following samples collected from wild fish: 2 locations with 7 and 8 fish hosts, respectively, in which I retrieved and measured (length, weight, length/weight, pairwise relatedness) unequal and rather small (5-30) number

Re: [R] Combine vectors in order to form matrixes with combn

2009-09-21 Thread Phil Spector
Moreno - While it's possible to do what you want with 8 individual vectors, the problem is much easier to solve if you combine them into a list: v = list(c(2,5,6,8),c(3,7,9,11),c(13,4,2,7), c(3.4,6,11,21),c(1,9,45,3),c(2,76,4,2), c(34,7,8,1),c(2,6,1,9)) combs = combn(1:length

Re: [R] Pattern Matching within Vector?

2009-09-21 Thread Charlie Sharpsteen
On Mon, Sep 21, 2009 at 8:07 AM, Anne-Marie Ternes wrote: > Dear mailing list, > > I'm stuck with a tricky problem here - at least it seems tricky to me, > being not really talented in pattern matching and regex matters. > > I'm analysing amino acid mutations by position and type of mutation. > E.

Re: [R] Executing R scripts from another R script

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 11:52 AM, Sergey Goriatchev wrote: Hello, everyone I run Eclipse Ganymede and R 2.7.2 at work. I have one R script file where I open in memory a new xls file (using xlsReadWritePro), call other R scripts, which are in the same folder as the main R script, which get data fro

Re: [R] Executing R scripts from another R script

2009-09-21 Thread Sergey Goriatchev
Sorry everyone Disregard this email. I found the problem. I have xlsReadWritePro loaded automatically at start of R. Then I load package gplots, which also loads gdata gdata masks function read.xls() from xlsReadWritePro and that causes all the problems. Regards, Sergey On Mon, Sep 21, 2009 at 1

  1   2   >