Re: [R] Odp: better way to trick data frame structure?

2010-05-04 Thread Seth
Thanks, works beautifully and saved hours of run time. -seth -- View this message in context: http://r.789695.n4.nabble.com/better-way-to-trick-data-frame-structure-tp2130470p2130486.html Sent from the R help mailing list archive at Nabble.com. __ R-h

[R] Odp: better way to trick data frame structure?

2010-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.05.2010 07:49:25: > > Hi, > > I have a data frame where 1 variable is a factor with only 1 level. I need > the data frame structure to reflect that there are 2 levels for this factor, > even though this is not the case. I am currently adding ext

[R] better way to trick data frame structure?

2010-05-04 Thread Seth
Hi, I have a data frame where 1 variable is a factor with only 1 level. I need the data frame structure to reflect that there are 2 levels for this factor, even though this is not the case. I am currently adding extra 'fake' rows to the data frame to ensure that 2 levels are present, but this i

Re: [R] readLines with space-delimiter?

2010-05-04 Thread Seth
Thanks. I wasn't aware that scan or read.table allowed you to read in a single line, process it, output results, and then read in the next line. This is what I need to do because the data set is too large to hold in RAM. I did manage to do this with readLines and overcome the space-delimiter is

[R] Help with dummy.coef

2010-05-04 Thread James M. Curran
Hi all, I've been revising some lecture notes and I have something that used to work with dummy.coef and now doesn't. A search of R help doesn't reveal any recent discussion on this function, so I'd appreciate your thoughts. The (compact/relevant) code is below, and complains at the line rep.

Re: [R] How to replace all values in a data.frame with another ( not 0) value

2010-05-04 Thread Nevil Amos
Thanks, this works, replacing the NA values with the "000/000' string. On 4/05/2010 11:20 PM, Muhammad Rahiz wrote: Hi Nevil, You can try a method like this x <- c(rnorm(5),rep(NA,3),rnorm(5)) # sample data dat <- data.frame(x,x) # make sample dataframe dat2 <- as.matrix(

[R] Creating Crosstabs using a sparse table

2010-05-04 Thread merrittr
Hi all I am trying to read in a table from a survey and get the error below gr12 <- read.table("gr12.csv", header=TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 249 elements how would I go about reading in a table of this data, I am

[R] question about 'write.table'

2010-05-04 Thread karena
I have a question about the "write.table" I have 100 data.frames, loci1, loci2, loci3.,loci100. now, I want to print these data.frames to 100 separate files, and the names of the files are also loci1, loci2, loci3,..., loci100. how to perform this under a "for" loop? say, for (i

Re: [R] Estimating theta for negative binomial model

2010-05-04 Thread Tim Clark
Brian, glm.convert() does exactly what I am wanting. Thanks for putting it in MASS. Sorry about not giving credit. It is a great package and I keep finding functions that make statistical programming easy! Aloha, Tim Tim Clark Department of Zoology University of Hawaii --- On Mon, 5/3/

Re: [R] Errors when trying to open odfWeave documents

2010-05-04 Thread Paul
Max Kuhn wrote: > I tried with this: > > > sessionInfo() > R version 2.10.1 (2009-12-14) > i386-pc-mingw32 > > I didn't have any issues with the testcases.odt and examples.odt files. > > :-/ > > > On Sun, May 2, 2010 at 11:39 AM, Dieter Menne > wrote: > >> Paul Hurley wrote: >> >>> Is t

Re: [R] How to make predictions with the predict() method on an arimax object using arimax() from TSA library

2010-05-04 Thread Dennis Murphy
Hi: If you look at the help page of the predict.Arima() function, you'll discover the problem: >forecast=predict(air.m1, n.ahead=15) Error in predict.Arima(air.m1, n.ahead = 15) : 'xreg' and 'newxreg' have different numbers of columns ^^ ## what's this newxreg?? > clas

[R] masking of objects between mtrace() and getYahooData()

2010-05-04 Thread zerdna
I am using getYahooData from TTR to get daily data. When i do it standalone, it is fine. It also works fine inside my code. However, when i run code inside mtrace(), i always get the following error: Error in xts(cbind(adj[[1]], adj[[2]]), index(obj)): order.by requires an appropriate time-base

[R] converting an objects list

2010-05-04 Thread Anthony Fristachi
Hello, I would like to convert an objects list such as objects() or ls() that outputs"a101""a102""a104""a107""a109" to read within a list statement as follows : list(a101,a102,a104,a107,a109) Thanks Tony

Re: [R] Delete rows with duplicate field...

2010-05-04 Thread kMan
Dear someone, Jorge's solution is excellent, assuming it is what you had in mind. Please note that the help page for unique() has duplicated() listed in its "See Also" section. Thus, when you studied ?unique(), it would have made sense to read about duplicated() as well. Or perhaps you did look in

Re: [R] Symbolic eigenvalues and eigenvectors

2010-05-04 Thread Steve Lianoglou
Hi John, It's common courtesy to keep all discussions originating from R-help back on list so it can act as a helpful resource for others to peruse when they have similar questions. With that in mind, I think you forgot to CC the list with your very informative follow-up reply to me: On Tue, May

Re: [R] Cross-checking a custom function for separability indices

2010-05-04 Thread Nikos Alexandris
Nikos: > Hi list! > > I have prepared a custom function (below) in order to calculate > separability indices (Divergence, Bhattacharyya, Jeffries-Matusita, > Transformed divergene) between two samples of (spectral land cover) > classes. I've found a mistake: initially I used "log10" instead of "l

Re: [R] readLines with space-delimiter?

2010-05-04 Thread jim holtman
Have you considered 'scan' or 'read.table'? This is what is mostly used in these situations. Read the chapter in the Intro to R on reading in data. On Tue, May 4, 2010 at 8:10 PM, Seth wrote: > > Hi, > I am reading a large space-delimited text file into R (41 columns and many > rows) and need

Re: [R] Visualizing binary response data?

2010-05-04 Thread Frank E Harrell Jr
On 05/04/2010 09:12 PM, Thomas Stewart wrote: For binary w.r.t. continuous, how about a smoothing spline? As in, x<-rnorm(100) y<-rbinom(100,1,exp(.3*x-.07*x^2)/(1+exp(.3*x-.07*x^2))) plot(x,y) lines(smooth.spline(x,y)) OR how about a more parametric approach, logistic regression? As in, glm

Re: [R] Visualizing binary response data?

2010-05-04 Thread Thomas Stewart
For binary w.r.t. continuous, how about a smoothing spline? As in, x<-rnorm(100) y<-rbinom(100,1,exp(.3*x-.07*x^2)/(1+exp(.3*x-.07*x^2))) plot(x,y) lines(smooth.spline(x,y)) OR how about a more parametric approach, logistic regression? As in, glm1<-glm(y~x+I(x^2),family=binomial) plot(x,y) lin

Re: [R] Symbolic eigenvalues and eigenvectors

2010-05-04 Thread Gabor Grothendieck
Eigenvalues are not directly supported by the Ryacas interface but you can send this directly to yacas like this: > yacas("EigenValues({{Cos(x), -Sin(x)}, {Sin(x), Cos(x)}})") [1] "Starting Yacas!" expression(Roots((cos(x) - xx)^2 + sin(x)^2)) On Tue, May 4, 2010 at 8:54 PM, John Mesheimer wrot

Re: [R] rgl: plane3d or abline() analog

2010-05-04 Thread Michael Friendly
Duncan Murdoch wrote: On 04/05/2010 4:19 PM, David Winsemius wrote: On May 4, 2010, at 4:09 PM, Michael Friendly wrote: For use with rgl, I'm looking for a function to draw a plane in an rgl scene that would function sort of like abline(a, b) does in base graphics, where abline(0, 1) draw

Re: [R] Symbolic eigenvalues and eigenvectors

2010-05-04 Thread John Mesheimer
Thanks, Steve. Can you please show me at least one hit that answers my question? On Tue, May 4, 2010 at 9:06 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi, > > On Tue, May 4, 2010 at 8:54 PM, John Mesheimer > wrote: > > Let's say I had a matrix like this: > > > > library(Rya

Re: [R] Symbolic eigenvalues and eigenvectors

2010-05-04 Thread Steve Lianoglou
Hi, On Tue, May 4, 2010 at 8:54 PM, John Mesheimer wrote: > Let's say I had a matrix like this: > > library(Ryacas) > x<-Sym("x") > m<-matrix(c(cos (x), sin(x), -sin(x), cos(x)), ncol=2) > > How can I use R to obtain the eigenvalues and eigenvectors? R> help.search('eigenvalues') is a good star

[R] Visualizing binary response data?

2010-05-04 Thread Kim Jung Hwa
Hi All, I'm dealing with binary response data for the first time, and I'm confused about what kind of graphics I could explore in order to pick relevant predictors and their relation with response variable. I have 8-10 continuous predictors and 4-5 categorical predictors. Can anyone suggest what

[R] Symbolic eigenvalues and eigenvectors

2010-05-04 Thread John Mesheimer
Let's say I had a matrix like this: library(Ryacas) x<-Sym("x") m<-matrix(c(cos (x), sin(x), -sin(x), cos(x)), ncol=2) How can I use R to obtain the eigenvalues and eigenvectors? Thanks, John [[alternative HTML version deleted]] __ R-help@r-p

Re: [R] installing a package in linux

2010-05-04 Thread Tengfei Yin
Hi R basic packages always works fine in my laptop (also ubuntu), you don't need to reinstall anything once you installed the package, did you do that in your terminal like $R (enter R session) >install.packages('package name') >q() then everytime you enter the R session, you just library('packag

Re: [R] Two Questions on R (call by reference and pre-compilation)

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 5:05 PM, Ruihong Huang wrote: Hi All, I have two questions on R. Could you please explain them to me? Thank you! 1) When call a function, R typically copys the values to formal arguments (call by value). This is very cost, if I would like to pass a huge data set to a function. I

Re: [R] rgl: plane3d or abline() analog

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 4:19 PM, David Winsemius wrote: On May 4, 2010, at 4:09 PM, Michael Friendly wrote: For use with rgl, I'm looking for a function to draw a plane in an rgl scene that would function sort of like abline(a, b) does in base graphics, where abline(0, 1) draws a line of unit slope

[R] readLines with space-delimiter?

2010-05-04 Thread Seth
Hi, I am reading a large space-delimited text file into R (41 columns and many rows) and need to do run each row's values through another R object and then write to another text file. So, far using readLines and writeLines seems to be the best bet. I've gotten the data exchange working except ea

Re: [R] R formula language---a min and max function?

2010-05-04 Thread Gabor Grothendieck
On Tue, May 4, 2010 at 7:39 PM, Gabor Grothendieck wrote: > For fixed c, y is linear in pmin(c, x) so the first two statements > find c and the next solves the remaining linear problem > Here is a slightly shorter f: f <- function(c) sum(resid(lm(y ~ pmin(c, x)))^2) > f <- function(c) sum((y -

Re: [R] R formula language---a min and max function?

2010-05-04 Thread Gabor Grothendieck
For fixed c, y is linear in pmin(c, x) so the first two statements find c and the next solves the remaining linear problem f <- function(c) sum((y - fitted(lm(y ~ pmin(c, x^2) fit.c <- optimize(f, c(0, max(DF$x))); fit.c lm(y ~ pmin(fit.c$minimum, x)) as a function of c On Tue, May 4, 2010

[R] Openings in the Consulting Department of XLSolutions Corp

2010-05-04 Thread s...@xlsolutions-corp.com
Dear useRs, Please help me find the ideal candidates for 2 R programming consulting positions at XLSolutions Corp. The job entails building custom applications for our end users. R programming is vital and skill in data analysis is important. If you are interested in working with our consulting

Re: [R] Lazy evaluation in function call

2010-05-04 Thread Bert Gunter
Inline below. -- Bert Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Joris Meys Sent: Tuesday, May 04, 2010 2:52 PM To: Thorn Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Lazy evalua

Re: [R] Two Questions on R (call by reference and pre-compilation)

2010-05-04 Thread Steve Lianoglou
Hi, On Tue, May 4, 2010 at 5:05 PM, Ruihong Huang wrote: > Hi All, > > I have two questions on R. Could you please explain them to me? Thank you! > > 1) When call a function, R typically copys the values to formal arguments > (call by value). This is technically incorrect. As far as I know, R h

Re: [R] Show number at each bar in barchart?

2010-05-04 Thread Carl Witthoft
But before you go any further, please read some of Edward Tufte's material on clarity and simplicity in graphs. > On Tue, May 4, 2010 at 8:41 AM, someone <> wrote: > >> >> when i plot a barchart with 5 bars there is one bar pretty long and >> the >> others get smaller >> like (20, 80, 20

Re: [R] Lazy evaluation in function call

2010-05-04 Thread Joris Meys
I think you'll have to code it a bit different. I'd do : f <- function(x,y){ if(missing(y)) y <-x x+y } > f(2) [1] 4 > f(2,3) [1] 5 > On Tue, May 4, 2010 at 4:26 PM, Thorn wrote: > Hi everybody, > > how is it possible to refer to an argument passed to a function in the > function call? What I li

Re: [R] R formula language---a min and max function?

2010-05-04 Thread David Winsemius
On May 4, 2010, at 5:25 PM, ivo welch wrote: thank you, david and gabor. very much appreciated. I should have thought of setting the seed. this was only an example, of course. alas, such intermittent errors could still be of concern to me, because I need to simulate this nls() to find out it

Re: [R] timing a function

2010-05-04 Thread Joris Meys
?system.time can help too. On Tue, May 4, 2010 at 11:07 PM, pdb wrote: > > Hi, > I want to time how long a function takes to execute. Any clues on what to > search for to achieve this? > > Thanks in advance. > -- > View this message in context: > http://r.789695.n4.nabble.com/timing-a-function-t

Re: [R] R formula language---a min and max function?

2010-05-04 Thread ivo welch
thank you, david and gabor. very much appreciated. I should have thought of setting the seed. this was only an example, of course. alas, such intermittent errors could still be of concern to me, because I need to simulate this nls() to find out its properties under the NULL, so I can't easily to

Re: [R] timing a function

2010-05-04 Thread mohamed . lajnef
Hi, ? proc.time() for more help regards Ml pdb a écrit : Hi, I want to time how long a function takes to execute. Any clues on what to search for to achieve this? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/timing-a-function-tp2126319p2126319.html

[R] timing a function

2010-05-04 Thread pdb
Hi, I want to time how long a function takes to execute. Any clues on what to search for to achieve this? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/timing-a-function-tp2126319p2126319.html Sent from the R help mailing list archive at Nabble.com.

[R] Two Questions on R (call by reference and pre-compilation)

2010-05-04 Thread Ruihong Huang
Hi All, I have two questions on R. Could you please explain them to me? Thank you! 1) When call a function, R typically copys the values to formal arguments (call by value). This is very cost, if I would like to pass a huge data set to a function. Is there any situations that R doesn't copy t

Re: [R] Avoiding for-loop for splitting vector into subvectors based on positions

2010-05-04 Thread Joris Meys
Thanks, works nicely. I have to do some clocking to see how much the improvement is, but I surely learnt again. Attentive readers might have noticed my initial code contains an error. tmp <- x[pos2[i]:pos2[i+1]] should be: tmp <- x[pos2[i]:(pos2[i+1]-1)] off course... On Tue, May 4, 2010 at 5:50

[R] Error when invoking x11()

2010-05-04 Thread Alex Chelminsky
I'm running an instance of R under Solaris 10.(sun4u sparc). When I invoke the x11() interface, I get the following error: > x11() Error in x11() : X11 module cannot be loaded In addition: Warning message: In x11() : unable to load shared library '/usr/local/lib/R/modules//R_X11.so': ld.so.1:

Re: [R] Agreement

2010-05-04 Thread Tobias Verbeke
Hi Grégoire, HB8 wrote: Has Lawrence Lin's code been ported to R? http://tigger.uic.edu/~hedayat/sascode.html One of Lin's methods (CCC) is available in function epi.ccc of the epiR package. Best, Tobias _

Re: [R] generating correlated random variables from different distributions

2010-05-04 Thread Greg Snow
Transforming variables will generally change the correlation, so your method will give you correlated variables, but not exactly at the correlations you specify (though with some trial and error you may be able to get close). If you are happy with those results, then your problem is solved, if

Re: [R] rgl: plane3d or abline() analog

2010-05-04 Thread David Winsemius
On May 4, 2010, at 4:09 PM, Michael Friendly wrote: For use with rgl, I'm looking for a function to draw a plane in an rgl scene that would function sort of like abline(a, b) does in base graphics, where abline(0, 1) draws a line of unit slope through the origin. Analogously, I'd like to hav

[R] rgl: plane3d or abline() analog

2010-05-04 Thread Michael Friendly
For use with rgl, I'm looking for a function to draw a plane in an rgl scene that would function sort of like abline(a, b) does in base graphics, where abline(0, 1) draws a line of unit slope through the origin. Analogously, I'd like to have a plane3d function, so that plane3d(0, 1, 1) draws a p

Re: [R] R formula language---a min and max function?

2010-05-04 Thread David Winsemius
On May 4, 2010, at 3:52 PM, ivo welch wrote: thank you, david. indeed. works great (almost). an example for anyone else googling this in the future: x=1:20 y= 2+3*ifelse(x>10, 10, x)+rnorm(20,0,0.01) r1= nls( y~ a+b*pmin(c,x), start=list(a=2, b=3, c=10), trace=TRUE ) 0.002142 : 2 3 10

Re: [R] R formula language---a min and max function?

2010-05-04 Thread Gabor Grothendieck
You need to use set.seed first so that your example is reproducible. Using set.seed(1) there is no error: > set.seed(1) > x=1:20 > y= 2+3*ifelse(x>10, 10, x)+rnorm(20,0,0.01) > r1= nls( y~ a+b*pmin(c,x), start=list(a=2, b=3, c=10), trace=TRUE ) 0.001657260 : 2 3 10 0.00153709 : 1.998312 3.0005

Re: [R] R formula language---a min and max function?

2010-05-04 Thread ivo welch
thank you, david. indeed. works great (almost). an example for anyone else googling this in the future: > x=1:20 > y= 2+3*ifelse(x>10, 10, x)+rnorm(20,0,0.01) > r1= nls( y~ a+b*pmin(c,x), start=list(a=2, b=3, c=10), trace=TRUE ) 0.002142 : 2 3 10 0.002115 : 2.004 3.000 10.000 0.002114 :

Re: [R] R formula language---a min and max function?

2010-05-04 Thread David Winsemius
On May 4, 2010, at 3:33 PM, ivo welch wrote: Dear R experts---I would like to estimate a non-linear least squares expression that looks something like y ~ a+b*min(c,x) where a, b, and c are the three parameters. how do I define a min function in the formula language of R? advice appreciat

[R] R formula language---a min and max function?

2010-05-04 Thread ivo welch
Dear R experts---I would like to estimate a non-linear least squares expression that looks something like y ~ a+b*min(c,x) where a, b, and c are the three parameters. how do I define a min function in the formula language of R? advice appreciated. sincerely, /iaw _

Re: [R] randomforests - how to classify

2010-05-04 Thread Changbin Du
use (as.factor(target) ~., data =your data, ...) On Tue, May 4, 2010 at 12:07 PM, pdb wrote: > > Hi, > > I'm experimenting with random forests and want to perform a binary > classification task. > I've tried some of the sample codes in the help files and things run, but I > get a message to

[R] installing a package in linux

2010-05-04 Thread Fahim Md
I recently started using ubuntu 9.10 and I am using gedit editor and R plugin for writing R code. To install any package I need to do: $ install.packages() //window pop-up for mirror selection //then another window pop up for package selection. After this as long as I am not exiting, the function

[R] randomforests - how to classify

2010-05-04 Thread pdb
Hi, I'm experimenting with random forests and want to perform a binary classification task. I've tried some of the sample codes in the help files and things run, but I get a message to the effect 'you don't have very many unique values in the target - are you sure you want to do regression?' (so

Re: [R] unsubcribe

2010-05-04 Thread Cedrick W. Johnson
https://stat.ethz.ch/mailman/listinfo/r-help On 5/4/2010 2:25 PM, Galois Theory wrote: [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Re : aregImpute (Hmisc package) : error in matxv(X, xcof)...

2010-05-04 Thread David Winsemius
On May 4, 2010, at 2:13 PM, Marc Carpentier wrote: Ok. I was afraid to refer to a known and obvious error. Here is a testing dataset (pb1.csv) and commented code (pb1.R) with the problems. Thanks for any help. Nothing attached. In all likelihood had you given these file names with extens

[R] unsubcribe

2010-05-04 Thread Galois Theory
[[alternative HTML version deleted]] __ 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-contained,

[R] Re : aregImpute (Hmisc package) : error in matxv(X, xcof)...

2010-05-04 Thread Marc Carpentier
Ok. I was afraid to refer to a known and obvious error. Here is a testing dataset (pb1.csv) and commented code (pb1.R) with the problems. Thanks for any help. Marc De : Uwe Ligges À : Marc Carpentier Cc : r-help@r-project.org Envoyé le : Mar 4 mai 2010, 13 h 52

[R] help overlay scatterplot to effects plot

2010-05-04 Thread Anderson, Chris
I have a process where I am creating a effects plot similar to the cowles effect example. I would like to add the point estimates to the effects plot, can someone show me the correct syntax. I have included the "R" effects example, so you can show me the correct syntax. Thanks mod.cowles <- g

[R] How to make predictions with the predict() method on an arimax object using arimax() from TSA library

2010-05-04 Thread a a
Hi R Users, I'm fairly new to R (about 3 months use thus far.) I wanting to use the arimax function from the TSA library to incorporate some exogenous inputs into the basic underllying arima model.Then with that newly model of type arimax, I would like to make a prediction. To avoid be

Re: [R] R for web browser

2010-05-04 Thread j verzani
Lanna Jin gmail.com> writes: > > > Hi Everyone, > > Does anyone know of any projects for running an interactive R session within > a web browser? > I'm looking for something similar to the one on the Ruby website > (http://tryruby.org), except for R. > > Thanks for your responses in advance!

Re: [R] Package Rsafd

2010-05-04 Thread David Winsemius
On May 4, 2010, at 1:12 PM, David Winsemius wrote: Try R-Forge I made that suggestion based on finding links to R-Forge searching for "rsafd" with RSeek but that was misleading. Try instead: http://orfe.princeton.edu/~rcarmona/SVbook/svbook.html On May 4, 2010, at 12:58 PM, Bo Li wrote

Re: [R] Package Rsafd

2010-05-04 Thread David Winsemius
Try R-Forge On May 4, 2010, at 12:58 PM, Bo Li wrote: Dear R community, I am looking for the package "Rsafd". It is not listed on the CRAN directory. I am wondering anyone has idea with this package. Thans a lot! David Winsemius, MD West Hartford, CT ___

[R] legend with lines and points

2010-05-04 Thread threshold
Hi, say there are x and y given as: level x y 3 0.112 0.012 2 0.432 0.111 1 0.415 0.053 3 0.380.005 2 0.607 0.01 1 NA NA 3 0.572 0.01 2 0.697 0.039 1 0.377 0.006 3 NA NA 2 0.571 0.003 1 0

[R] Package Rsafd

2010-05-04 Thread Bo Li
Dear R community, I am looking for the package "Rsafd". It is not listed on the CRAN directory. I am wondering anyone has idea with this package. Thans a lot! Bo _ The New Busy is not t

Re: [R] Flushing print buffer

2010-05-04 Thread jim holtman
I should have also had you read FAQ 7.16 On Tue, May 4, 2010 at 12:43 PM, jim holtman wrote: > explicitly print your data: > > print(head(object,...)) > On Tue, May 4, 2010 at 12:23 PM, Marshall Feldman wrote: > >> Hello, >> >> I have a function with these lines: >> >>test <- function(objec

Re: [R] Flushing print buffer

2010-05-04 Thread jim holtman
explicitly print your data: print(head(object,...)) On Tue, May 4, 2010 at 12:23 PM, Marshall Feldman wrote: > Hello, > > I have a function with these lines: > >test <- function(object,...){ > cat("object: has ",nrow(object),"labels\n") > cat("Head:\n") > head(obje

Re: [R] read.table: skipping trailing delimiters

2010-05-04 Thread Gabor Grothendieck
Re-read the colClasses section of ?read.table. Use "NULL", not NULL. On Tue, May 4, 2010 at 12:11 PM, Marshall Feldman wrote: > Hi, > > I am trying to read a tab-delimited file that has trailing tab delimiters. > It's a simple file with two legitimate fields. I'm using the first as > row.names,

Re: [R] read.table: skipping trailing delimiters

2010-05-04 Thread Marc Schwartz
On May 4, 2010, at 11:11 AM, Marshall Feldman wrote: > Hi, > > I am trying to read a tab-delimited file that has trailing tab delimiters. > It's a simple file with two legitimate fields. I'm using the first as > row.names, and the second should be the only column in the resulting data > frame.

[R] Flushing print buffer

2010-05-04 Thread Marshall Feldman
Hello, I have a function with these lines: test <- function(object,...){ cat("object: has ",nrow(object),"labels\n") cat("Head:\n") head(object,...) cat("\nTail:\n") tail(object,...) } If I feed it a data frame object, it only prints ou

Re: [R] strange behavior of RODBC and/or ssconvert

2010-05-04 Thread Gabor Grothendieck
The original seems not to have gotten through. Here it is again. On Tue, May 4, 2010 at 11:14 AM, Gabor Grothendieck wrote: > Try a few of the solutions here: > http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows > and see if they all give you the same result. > __

[R] read.table: skipping trailing delimiters

2010-05-04 Thread Marshall Feldman
Hi, I am trying to read a tab-delimited file that has trailing tab delimiters. It's a simple file with two legitimate fields. I'm using the first as row.names, and the second should be the only column in the resulting data frame. Initially, R was filling the last column with NA's, but I was

Re: [R] ISO Eric Kort (rtiff)

2010-05-04 Thread cgw
Thanks, Brian. I can see where to mod readTiff to return the original data ranges; and where to mod writeTiff so it writes files with something better than the current 0:255 resolution range. I have found an additional problem with readTiff, so is there someone I can write to about it? What

Re: [R] / Operator not meaningful for factors

2010-05-04 Thread John Kane
--- On Tue, 5/4/10, Petr PIKAL wrote: > From: Petr PIKAL > Subject: Re: [R] / Operator not meaningful for factors > To: "John Kane" > Cc: r-help@r-project.org, "vincent.deluard" > Received: Tuesday, May 4, 2010, 3:38 AM > Hi > > r-help-boun...@r-project.org > napsal dne 04.05.2010 00:50:00:

Re: [R] R for web browser

2010-05-04 Thread Tal Galili
I wrote about R-Node last month, it offers what you are talking about: http://www.r-statistics.com/2010/04/r-node-a-web-front-end-to-r-with-protovis/ Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read

Re: [R] Avoiding for-loop for splitting vector into subvectors based on positions

2010-05-04 Thread jim holtman
Try this: > x <- 1:10 > pos <- c(1,4,7) > pat <- rep(seq_along(pos), times=diff(c(pos, length(x) + 1))) > split(x, pat) $`1` [1] 1 2 3 $`2` [1] 4 5 6 $`3` [1] 7 8 9 10 On Tue, May 4, 2010 at 11:29 AM, Joris Meys wrote: > Dear all, > > I'm trying to optimize code and want to avoid for-loops

[R] Avoiding for-loop for splitting vector into subvectors based on positions

2010-05-04 Thread Joris Meys
Dear all, I'm trying to optimize code and want to avoid for-loops as much as possible. I'm applying a calculation on subvectors from a big one, and I get the subvectors by using a vector of starting positions: x <- 1:10 pos <- c(1,4,7) n <- length(x) I try to do something like this : pos2 <- c(p

Re: [R] Kernel density estimate plot for 3-dimensional data

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 11:03 AM, Pascal Martin wrote: #B <- pp3(runif(300), runif(300), runif(300), box3(c(0,1))) creates a 3d pattern with random points. But I want it to create a Kernel density estimate plot with my coordinates. I show it in an example: > x<- scan() 1: 1 2 3 4 5 6 7 8 9 10 11: Read 10

Re: [R] Kernel density estimate plot for 3-dimensional data

2010-05-04 Thread Pascal Martin
An: Duncan Murdoch Gesendet: Dienstag, den 4. Mai 2010, 17:03:46 Uhr Betreff: AW: [R] Kernel density estimate plot for 3-dimensional data #B <- pp3(runif(300), runif(300), runif(300), box3(c(0,1))) creates a 3d pattern with random points. But I want it to

Re: [R] 3D version of triax.plot (package plotrix)

2010-05-04 Thread Gabriele Esposito
Hi Jim, thanks! With just the rgl package I cannot do that. For the moment, I merged two values into one and use triax.plot in the package plotrix, but that's not fully satisfactory. If you find something, let me know, thank you a lot! Gabriele On Mon, May 3, 2010 at 2:29 PM, Jim Lemon wrote:

Re: [R] Idiomatic looping over list name, value pairs in R

2010-05-04 Thread Luis N
Thank you. Your response was enlightening. On Tue, May 4, 2010 at 11:38 PM, Duncan Murdoch wrote: > On 04/05/2010 10:24 AM, Luis N wrote: >> >> Considering the python code: >> >> for k, v in d.items(): do_something(k); do_something_else(v) >> >> I have the following for R: >> >> for (i in c(1:len

[R] strange behavior of RODBC and/or ssconvert

2010-05-04 Thread stefan.d...@gmail.com
Dear All, I have the following problem when reading files (a lot of them) in the spreadsheetML format into R. The spreadsheetML format is an xml format to allow easy import of multisheet data in Excel. As far as I can see, a direct import into R (using the XML package) is not feasible. I use the s

Re: [R] Kernel density estimate plot for 3-dimensional data

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 10:33 AM, Pascal Martin wrote: Hi! I have a problem with Kernel density estimate plot for 3-dimensional data in ks-package. Here the example: # load ks, spatstat # three-dimensional kernel density of B B <- pp3(runif(300), runif(300), runif(300), box3(c(0,1))) x <- unclass(B$data

[R] fit printed output onto a single page

2010-05-04 Thread Abiel X Reinhart
Is there a way to force a certain block of captured output to fit onto a single printed page, where one can specify the properties of the page (dimensions, margins, etc)? For example, I might want to generate 10 different cuts of a data table and then capture all the output into a PDF, ensuring

[R] Lazy evaluation in function call

2010-05-04 Thread Thorn
Hi everybody, how is it possible to refer to an argument passed to a function in the function call? What I like to do, is something like f <- function(x,y) x+y f(2, x) # should give 4 The problem is of course that x is only known inside the function. Of course I could specify something like f

Re: [R] Idiomatic looping over list name, value pairs in R

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 10:24 AM, Luis N wrote: Considering the python code: for k, v in d.items(): do_something(k); do_something_else(v) I have the following for R: for (i in c(1:length(d))) { do_something(names(d[i])); do_something_else(d[[i]]) } This does not seem seems idiomatic. What is the best w

Re: [R] Idiomatic looping over list name, value pairs in R

2010-05-04 Thread Christos Argyropoulos
Can you give an example of what the python code is supposed to do? Some of us are not familiar with python, and the R code is not particularly informative. You seem to encode information on both the values and the names of the elements of the vector "d". If this is the case, why don't you creat

[R] Kernel density estimate plot for 3-dimensional data

2010-05-04 Thread Pascal Martin
Hi! I have a problem with Kernel density estimate plot for 3-dimensional data in ks-package. Here the example: # load ks, spatstat # three-dimensional kernel density of B B <- pp3(runif(300), runif(300), runif(300), box3(c(0,1))) x <- unclass(B$data)$df H <- Hpi(x) fhat <- kde(x, H=H) plot(fhat)

Re: [R] Show number at each bar in barchart?

2010-05-04 Thread David Winsemius
On May 4, 2010, at 9:40 AM, Jorge Ivan Velez wrote: Hi someone, Try this: x <- c(20, 80, 20, 5, 2) b <- barplot(x, ylim = c(0, 85), las = 1) text(b, x+2, pch = x) I suspect he wanted the "counts" in the label: x <- c(20, 80, 20, 5, 2) b <- barplot(x, ylim = c(0, 85), las = 1) text(b, x+

[R] Memory issues using R withing Eclipse-StatET

2010-05-04 Thread Harsh
Hi useRs, I use R within Eclipse via StatET, and it seems to me that some memory intensive tasks fail due to this environment. For example: I was trying to find the distance matrix of a matrix with (1 rows and 500 columns), and it failed in StatET, whereas it worked in vanilla R. I'm using R

[R] Idiomatic looping over list name, value pairs in R

2010-05-04 Thread Luis N
Considering the python code: for k, v in d.items(): do_something(k); do_something_else(v) I have the following for R: for (i in c(1:length(d))) { do_something(names(d[i])); do_something_else(d[[i]]) } This does not seem seems idiomatic. What is the best way of doing the same with R? Thanks. L

[R] Odp: How to replace all values in a data.frame with another ( not 0) value

2010-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.05.2010 14:54:14: > I need to replace occurrences in multiple columns in a data.frame > with "000/000" Be careful if you replace NA in numeric columns. > str(test) 'data.frame': 10 obs. of 3 variables: $ mp: num 20.9 19.9 20.1 20.2 18.9 ...

Re: [R] Using R with screenreading software

2010-05-04 Thread Duncan Murdoch
On 04/05/2010 9:41 AM, Rainer Scheuchenpflug wrote: Dear R-Experts, a student of mine tries to use the Windows-Rconsole with screen reading software (she is blind), and cannot access the command line (Menus are ok). The company which produces her screen reader tells her that this is due to the c

[R] R for web browser

2010-05-04 Thread Lanna Jin
Hi Everyone, Does anyone know of any projects for running an interactive R session within a web browser? I'm looking for something similar to the one on the Ruby website (http://tryruby.org), except for R. Thanks for your responses in advance! Lanna - Lanna Jin lanna...@gmail.com 510-898-

Re: [R] make a column from the row names

2010-05-04 Thread John Kane
Have a look at ?substring --- On Tue, 5/4/10, Mohan L wrote: > From: Mohan L > Subject: [R] make a column from the row names > To: r-help@r-project.org > Received: Tuesday, May 4, 2010, 9:06 AM > Dear All, > > > avglog > 01/11/09 02/11/09 03/11/09 04/11/09 > 9.75 4.50 4.50 8.67

Re: [R] Show number at each bar in barchart?

2010-05-04 Thread Jorge Ivan Velez
Hi someone, Try this: x <- c(20, 80, 20, 5, 2) b <- barplot(x, ylim = c(0, 85), las = 1) text(b, x+2, pch = x) HTH, Jorge On Tue, May 4, 2010 at 8:41 AM, someone <> wrote: > > when i plot a barchart with 5 bars there is one bar pretty long and the > others get smaller > like (20, 80, 20, 5, 2

[R] Using R with screenreading software

2010-05-04 Thread Rainer Scheuchenpflug
Dear R-Experts, a student of mine tries to use the Windows-Rconsole with screen reading software (she is blind), and cannot access the command line (Menus are ok). The company which produces her screen reader tells her that this is due to the cursor used in Rconsole, which is static, not blinking.

Re: [R] Plotting legend outside of multiple panels

2010-05-04 Thread Patrick Lenon
Another solution I've used is to set up an additional layout space and put the legend in there with no graph. You print a blank dummy graph and then add the legend to the "blank" layout panel like so: if (floatLegend) { # We want to float the legend independently # so we have to add

  1   2   >