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] 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

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

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 Yahoo!

[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 bytes Is

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,

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

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 Each

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 dwinsem...@comcast.net

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) Error

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 Each

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 aditi.si...@bristol.ac.uk 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)

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 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

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 h.wick...@gmail.com wrote: From: hadley wickham h.wick...@gmail.com Don't use attach? Obvously good advice but why? __ The new Internet Explorer® 8 - Faster, safer, easier.

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 mtmor...@fhcrc.org To: Vassilis Golfinopoulos

[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

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,

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,

[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

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

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

Re: [R] correlation help

2009-09-21 Thread John Kane
library(psych) corr.test(d6) ? --- On Sun, 9/20/09, Adrian Johnson oriolebaltim...@gmail.com wrote: From: Adrian Johnson oriolebaltim...@gmail.com 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

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 is

Re: [R] correlation help

2009-09-21 Thread Liviu Andronic
On 9/21/09, William Revelle li...@revelle.net 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] 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] 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

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

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

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;

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

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

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

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 data

[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

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),

Re: [R] logarithmic seq() ?

2009-09-21 Thread Oliver Bandel
Ted.Harding at 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 would

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 hellangel_...@yahoo.comwrote: Is there a standard command that I can use to

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:

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

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

Re: [R] xtable - print - suppress output

2009-09-21 Thread Charlie Sharpsteen
On Mon, Sep 21, 2009 at 3:52 PM, Don MacQueen m...@llnl.gov 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

[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 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 ch...@sharpsteen.net wrote: On Mon, Sep 21, 2009 at 3:52 PM, Don MacQueen m...@llnl.gov wrote: snip... In other words, there is no such

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)

[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] 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 pengyu...@gmail.com 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

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

[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 then

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, ankyrin repeat and PH

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 pengyu...@gmail.com 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.119687  

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.119687 [9]

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 this:

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

2009-09-21 Thread hadley wickham
From: hadley wickham h.wick...@gmail.com 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] 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 67

<    1   2