[R] How to change the class of data?

2008-06-12 Thread Qman Fin
Hi all, I have some data x, which are actualy consisted of numerical enties. But the class of this matrix is set to be factor by someone else. I used class(x), it turns out to be factor. So I can not calculate them. How can I turn them into numerical data so that I can apply math operations on

[R] The log function problem

2008-06-12 Thread Shubha Vishwanath Karanth
Hi R, Please see the below commands. The question is I can see the value of log(2) before loading the package fcalendar in R. But after loading the package, the 'log' function doesn't work. How to solve this problem? Also note that the function code differs before and after downloading the

Re: [R] The log function problem

2008-06-12 Thread Yohan Chalabi
SVK == Shubha Vishwanath Karanth [EMAIL PROTECTED] on Thu, 12 Jun 2008 12:02:25 +0530 SVK Hi R, SVK SVK SVK SVK Please see the below commands. The question is I can see the value of SVK log(2) before loading the package fcalendar in R. But after loading the SVK package,

Re: [R] How to change the class of data?

2008-06-12 Thread Frankg
When you have a data X with a class factor, you can transform it to numeric as y-as.numeric(X) to transform it to a factor again use y-as.factor(X) -- View this message in context: http://www.nabble.com/How-to-change-the-class-of-data--tp17793351p17793713.html Sent from the R help mailing

Re: [R] How to change the class of data?

2008-06-12 Thread Charilaos Skiadas
On Jun 12, 2008, at 2:24 AM, Qman Fin wrote: Hi all, I have some data x, which are actualy consisted of numerical enties. But the class of this matrix is set to be factor by someone else. I used class(x), it turns out to be factor. So I can not calculate them. The typical approach is to

Re: [R] How to change the class of data?

2008-06-12 Thread Moshe Olshansky
If x is a vector (one dimensional) then as.numeric(levels(x)) works - I am not sure whether this is the best solution. If you have a matrix you can use apply, i.e x1 - apply(x,2,function(a) as.numeric(levels(a))) --- On Thu, 12/6/08, Qman Fin [EMAIL PROTECTED] wrote: From: Qman Fin [EMAIL

Re: [R] How to change the class of data?

2008-06-12 Thread Christoph Heibl
Try: x - factor(1:10) class(x) x + 1 class(x) - numeric x+1 On Jun 12, 2008, at 8:24 AM, Qman Fin wrote: Hi all, I have some data x, which are actualy consisted of numerical enties. But the class of this matrix is set to be factor by someone else. I used class(x), it turns out to be

[R] help

2008-06-12 Thread tayyaba rafiq
i am new user of R-language. i have problem in attachment of spss file . i have downloaded the foreign package but i have still problem in attachment. i am typing 'data=read.spss(file name.choose()). is it right or not? could you plz tell me the way for attachment? thanks

Re: [R] How to change the class of data?

2008-06-12 Thread anna freni sterrantino
Hi Selina, try ?as.numeric, small example a=c(1,2,3,4,5) b=as.factor(a) class(b) c=as.numeric(b) class(c) in the case of a matrix of factor,try apply(matrix,1, as.numeric) Cheers A. - Messaggio originale - Da: Qman Fin [EMAIL PROTECTED] A: r-help@r-project.org Inviato: Giovedì

[R] ADaCGH package crashes at mpiInit()

2008-06-12 Thread Daren Tan
I have successfully installed ADaCGH package, and trying the example in SegmentPlotWrite did produce alot of pngs and html. I tried again the same example this morning (after a long night of installation), ADaCGH crashes at mpiInit() showing the error: Loading required package: Rmpi

Re: [R] How to change the class of data?

2008-06-12 Thread Charilaos Skiadas
Seeing how there have been three wrong answers so far, I should point out that: 1) This is an FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How- do-I-convert-factors-to-numeric_003f 2) Most of the other methods suggested so far fail if the example x used is not of the form 1:n. The

Re: [R] How to change the class of data?

2008-06-12 Thread Philipp Pagel
On Thu, Jun 12, 2008 at 03:42:23AM -0400, Charilaos Skiadas wrote: Seeing how there have been three wrong answers so far, I should point out that: 1) This is an FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How- do-I-convert-factors-to-numeric_003f Going over the r-help archive, we

Re: [R] How to change the class of data?

2008-06-12 Thread Kenn Konstabel
Conversion to factor may happen (and often does) when you read in data with read.table(). So one solution may be reading in the same data again in a slightly different way: read.table(file=mydatafile, as.is=TRUE) # see also ?read.table You can also specify a class to each column of the data

Re: [R] mgcv::gam error message for predict.gam

2008-06-12 Thread Simon Wood
Wild extrapolation thought it is... it works for me with mgcv 1.4-0 and R 2.7.0 on linux: test 1 2 3 45 20.73032 16.83549 59.42120 29.07759 13.09754 what mgcv and R versions are you using, and on what OS? (btw `gam.method' isn't

Re: [R] How to change the class of data?

2008-06-12 Thread Birgitle
I have an additional question concerning to this topic. I usually use something liek that: read.table(, colClasses=c(numeric, factor, character, my.funny.class)) but why can I not implement ordered.factor in there? Birgit Kenn Konstabel wrote: Conversion to factor may happen (and

[R] How to extract rows from matrices consistently?

2008-06-12 Thread Feng, Ken
Hi, How do I ensure that I always get a matrix back when I extract rows? The mickey-mouse example doesn't matter much, but if instead of 1:2 or 1, I have a vector which may have 1 or more values, then I'm in trouble. Any way to make this consistently return a matrix? Thx in advance. - Ken #

[R] XML parameters to Column Headers for importing into a dataset

2008-06-12 Thread ajay ohri
Dear List, Do you know any way I can convert XML parameters into column headers. My data is in a csv file with each row containing a xml form of data , and multiple parameters ( param1 data_val1 /param2 , param2 data_val2 /param2 ) I want to convert it so each row caters to one record and each

Re: [R] How to extract rows from matrices consistently?

2008-06-12 Thread Wacek Kusnierczyk
Feng, Ken wrote: Hi, How do I ensure that I always get a matrix back when I extract rows? The mickey-mouse example doesn't matter much, but if instead of 1:2 or 1, I have a vector which may have 1 or more values, then I'm in trouble. Any way to make this consistently return a matrix? Thx

[R] timereg and relative risks

2008-06-12 Thread Bernat Gel
Hi all, I've been reading and using the information from the list for some time but this is my first question here. English is not my primary language, so sorry in advance for any language mistakes. :) I'm working with the timereg package to analize survival data. I want to perform a

Re: [R] difference between nlm and nlminb

2008-06-12 Thread DavidM.UK
Thank you for those details, the only optimization routine I've come accross outside of CRAN is: http://www.stat.umn.edu/geyer/trust/ Personally I only use nlminb for the estimation of Time Series models, which typically have well defined limits for the elements of the parameter vector - so in

Re: [R] ADaCGH package crashes at mpiInit()

2008-06-12 Thread Ramon Diaz-Uriarte
Dear Daren, First, please note that since this problem concerns a particular package, you are supposed to contact the package maintainer (me) directly. (See the R-FAQ, 9.2). Anyway, I've never seen that error message before. But I think it indicates a problem with your MPI setup, nothing related

Re: [R] How to change the class of data?

2008-06-12 Thread Prof Brian Ripley
On Thu, 12 Jun 2008, Birgitle wrote: I have an additional question concerning to this topic. I usually use something liek that: read.table(, colClasses=c(numeric, factor, character, my.funny.class)) but why can I not implement ordered.factor in there? Because the help page says

Re: [R] applying a function recursively

2008-06-12 Thread Jim Lemon
Georg Otto wrote: Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of recursion: ... I understand that with a fixed number of recursion levels one can use lapply() in a nested way, but what

[R] as.numeric(.) returns 0

2008-06-12 Thread Paul Johnson
In R version 2.7.0 (2008-04-22) as.numeric(.) returns zero. as.numeric(.) [1] 0 This must be a bug. Splus and previous versions of R (= 2.6.0) return NA, as you might expect. I'm running R version 2.7.0 (2008-04-22) on Windows XP. Paul _

Re: [R] applying a function recursively

2008-06-12 Thread Georg Otto
Hi, thanks a lot for your help. Somehow rapply had escaped my notice. I also have a follow-up question on that. I would like to flatten my output list to a list with only one level. Option unlist in rapply returns a character vector, in my example: rapply(test.list, rev, how=unlist) I.A1

Re: [R] applying a function recursively

2008-06-12 Thread Jim Lemon
Prof Brian Ripley wrote: See ?rapply Golly, the things one learns when least expecting it. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] as.numeric(.) returns 0

2008-06-12 Thread Karl Ove Hufthammer
Paul Johnson: In R version 2.7.0 (2008-04-22) as.numeric(.) returns zero. as.numeric(.) [1] 0 Seems to be fixed already. In R version 2.7.0 Patched (2008-06-12 r45898): $ as.numeric(.) [1] NA Warning message: NAs introduced by coercion -- Karl Ove Hufthammer

[R] read and write stdout() to tktext window

2008-06-12 Thread Andreas Posch
I've been trying to write the consoles output to a tktext window, but have not succeeded... Does anybody know if that works? Any help would be highly appreciated. Thanks in advance, Andreas Posch __ R-help@r-project.org mailing list

Re: [R] as.numeric(.) returns 0

2008-06-12 Thread Peter Dalgaard
Paul Johnson wrote: In R version 2.7.0 (2008-04-22) as.numeric(.) returns zero. as.numeric(.) [1] 0 This must be a bug. Splus and previous versions of R (= 2.6.0) return NA, as you might expect. I'm running R version 2.7.0 (2008-04-22) on Windows XP. I suspect that this got

Re: [R] Close Window Button Problems

2008-06-12 Thread Prof Brian Ripley
You have failed to provide the most basic of information as requested in the posting guide. As you mention 'i create a x11 window and plot' I will assume you mean that you open an X11() device and hence this is some Unix-alike OS. This has come up several times before, so please search the

[R] Predicting from an nls model

2008-06-12 Thread Ranney, Steven
I keep running up against the same error when I try to plot a line from a nls model. The data is fisheries length/weight data. Code follows: require(graphics) pow = nls(Weight~alpha*Length^beta, data=wae, start=list(alpha=0.001, beta=3.0), trace=TRUE)

Re: [R] Predicting from an nls model

2008-06-12 Thread Ben Bolker
Ranney, Steven steven.ranney at montana.edu writes: plot(Weight~Length, data = wae, pch=19, xlab=Length (mm), ylab=Weight (g), xlim = c(150,1000), ylim = c(0, 10050)) mod = seq(150, 1000)

Re: [R] Predicting from an nls model

2008-06-12 Thread Prof Brian Ripley
To predict from Weight~alpha*Length^beta you need to specify Length, not Weight. It is most likely finding Length from your workspace. On Thu, 12 Jun 2008, Ranney, Steven wrote: I keep running up against the same error when I try to plot a line from a nls model. The data is fisheries

Re: [R] Predicting from an nls model

2008-06-12 Thread Ranney, Steven
Thanks. As a (relatively) new user of R and programming in general, I tend to miss things like that. I appreciate your patience. SR Steven H. Ranney Graduate Research Assistant (Ph.D) USGS Montana Cooperative Fishery Research Unit Montana State University PO Box 173460 Bozeman, MT 59717-3460

Re: [R] applying a function recursively

2008-06-12 Thread Gabor Grothendieck
Wrap each element in an environment, flatten that and then extact the element in each environment. (Be sure not to use an old version of R since sufficiently far back R had a bug when environments were stored in lists that was since fixed.) L - rapply(test.list, function(el) environment(), how =

Re: [R] cch function and time dependent covariates

2008-06-12 Thread Terry Therneau
- begin included message In case cohort study, we can fit proportional hazard regression model to case-cohort data. In R, the function is cch() in Survival package Now I am working on case cohort analysis with time dependent covariates using cch() of Survival R package. I wonder if cch()

[R] controlling location of labels in axis()

2008-06-12 Thread Andrew Yee
Here's a naive question about axis() How do you control the location of the labels with the axis() command? In the following example: foo - data.frame(plot.x=seq(1:3), plot.y=seq(4:6)) plot(foo$plot.x, foo$plot.y, type='n', axes=FALSE) points(foo$plot.x, foo$plot.y) axis(1, at=foo$plot.x,

Re: [R] controlling location of labels in axis()

2008-06-12 Thread Toby Marthews
Hi Andrew, Perhaps this example would help. You can add in spaces to the mtext text to move the text sideways. par(mai=c(0.5,0.5,0.5,0.5),oma=c(2,2,2,2)) #mai units are INCHES, oma units are LINES plot(runif(50),xlab=xlab,ylab=ylab,bty=l) #n.b. these labels don't appear mtext(First inner x

[R] p-value

2008-06-12 Thread mohamed nur anisah
Dear R User, say I have this sample of data ( attach with). What i'm going to do is to test whether this data is uniformly distributed or not by finding the p-value. I've tried using the punif command but it gave me the value of 1 of all the data. Any suggestion on R command to find the

Re: [R] p-value

2008-06-12 Thread John Gant
Here's a sample: unif_rand_1 - runif(1000); unif_rand_2 - runif(1000); ks.test(unif_rand_1,unif_rand_2); Two-sample Kolmogorov-Smirnov test data: unif_rand_1 and unif_rand_2 D = 0.021, p-value = 0.9802 alternative hypothesis: two-sided So in your case: ks.test( runif( length(

Re: [R] p-value

2008-06-12 Thread Richardson, Patrick
Something like. . . midpoint - c(132968364, 135945080, 156539568, 157817896, + 162399496, 168344072, 173146584, 176302744, + 182878168, 183946152, 185068720, 190791232, + 84317660, 93708872, 106810172, 12684, + 148519056, 150945112, 155771432, 181069984, + 87104384 + )

[R] About Mcneil Hanley test for a portion of AUC!

2008-06-12 Thread Dukka k.c.
Dear all I am trying to compare the performances of several methods using the AUC0.1 and not the whole AUC. (meaning I wanted to compare to AUC's whose x axis only goes to 0.1 not 1) I came to know about the Mcneil Hanley test from Bernardo Rangel Tura and I referred to the original paper for

Re: [R] p-value

2008-06-12 Thread Felipe Carrillo
Not sure if this is what you are looking for but you can get the p-value with something like this: # Create a vector mydata- c(132968364, 135945080, 156539568, 157817896, 162399496, 168344072, 173146584, 176302744, 182878168, 183946152,

[R] R/S course in *** New York City *** July 28-29 by XLSolutions Corp

2008-06-12 Thread Sue Turner
Our July *** New York City *** R/S Fundamentals and Programming Techniques is scheduled for: New York City / July 28-29, 2008 *** Please direct enquiries to Sue Turner: [EMAIL PROTECTED] Ask for Group Discount --- Looking for R Advanced course? It's comming up in Seattle

Re: [R] cch function and time dependent covariates

2008-06-12 Thread Jin Wang
I tried your alternative method on the example in cch() description manual. The example data nwtco has not time-dependent covariates yet. I test cch() and coxph() on the same data. But the estimation result is different. I don't know if I did anything wrong. subcoh - nwtco$in.subcohort selccoh -

Re: [R] model simplification using Crawley as a guide

2008-06-12 Thread Peter Dalgaard
Simon Blomberg wrote: Good points Ben. For now I'd recommend simply that the allergic reaction to insignificant statistical tests be treated with an antihistamine :-) A vote for Frank's comment to be added to the 'fortunes' package. Seconded! :-) That'll be

Re: [R] model simplification using Crawley as a guide

2008-06-12 Thread Marc Schwartz
on 06/12/2008 09:37 AM Peter Dalgaard wrote: Simon Blomberg wrote: Good points Ben. For now I'd recommend simply that the allergic reaction to insignificant statistical tests be treated with an antihistamine :-) A vote for Frank's comment to be added to the 'fortunes' package.

Re: [R] problem with function rep

2008-06-12 Thread Erik Iverson
We need a reproducible example of this to tell you what is going on. Find a small example that exhibits the confusing behavior, and share it with the list. Julien Hunt wrote: To whom it may concern, I am currently writing a program where I need to use function rep. The results I get are

Re: [R] controlling location of labels in axis()

2008-06-12 Thread Andrew Yee
Thanks for the reply. I think I've figured it out, you can set this with the mgp parameter. So I'd use the following statement instead: axis(1, at=foo$plot.x, labels=foo$plot.x, mgp=c(3,0.5,1)) #this brings the axis labels closer to the axis line Andrew On Thu, Jun 12, 2008 at 9:53 AM, Toby

Re: [R] problem with function rep

2008-06-12 Thread Berwin A Turlach
G'day Julien, On Thu, 12 Jun 2008 16:48:43 +0200 Julien Hunt [EMAIL PROTECTED] wrote: I am currently writing a program where I need to use function rep. The results I get are quite confusing. Given two vectors A and B, I want to replicate a[1] b[1] times, a[2] b[2] times and so on. All

Re: [R] problem with function rep

2008-06-12 Thread Marc Schwartz
on 06/12/2008 09:48 AM Julien Hunt wrote: To whom it may concern, I am currently writing a program where I need to use function rep. The results I get are quite confusing. Given two vectors A and B, I want to replicate a[1] b[1] times, a[2] b[2] times and so on. All the entries of vector B

Re: [R] cch function and time dependent covariates

2008-06-12 Thread Jin Wang
same subject id has to be multiple in mutiple times like following format, Multiple records per id not allowed in cch() so it's difficult to use cch() for time dependent covariate. Maybe coxph() is alternative, but seems difficult because coxph() and cch() return different estimate for same data

[R] Generate Random Samples

2008-06-12 Thread Peng Jiang
Hi, I am a newbie to R and I am working with a Mac. Is there any package that I can use to generate random samples from a user defined distribution ? That is , I define a distribution function ( maybe multi dimension ) and I want some random samples generated from my this distribution.

Re: [R] case-cohort

2008-06-12 Thread Terry Therneau
Jin Wang had an error. My original note specified a variable that was 1 for subjects NOT in the subcohort, so the correct coxph call is coxph(Surv(edrel, rel) ~ stage + histol + age + offset(-100*(subcohort==0)) + cluster(seqno), data =ccoh.data) This gives the same

[R] How to increase the for() loop speed?

2008-06-12 Thread Rafael Barros de Rezende
Dear R users, I would like to know if there is a way to increase the for() loop speed because in my routine the calculations are too slow. Best regards. Rafael Barros de Rezende Cedeplar - Center for Development and Regional Planning Face, UFMG

Re: [R] problem with function rep

2008-06-12 Thread Erik Iverson
Berwin appears to be correct here. After you do x - x / 0.0001, I inserted a call to round(x) - x, and received round(x) - x [1] 7.275958e-12 0.00e+00 0.00e+00 This is basically a case of FAQ 7.31. Julien Hunt wrote: Hi I believe this should provide an example of the confusing

[R] Problem with Freq function {prettyR}

2008-06-12 Thread Udo
Dear list, I have a problem with freq from prettyR. Please have a look at my syntax with a litte example: library(prettyR) #Version 1 test.df-data.frame(q1=sample(1:4,8,TRUE), gender=sample(c(f,m),8,TRUE)) test.df freq(test.df) #No error message #Version 2

[R] How to increase the for() loop speed?

2008-06-12 Thread Rafael Barros de Rezende
Dear R users, I would like to know if there is a way to increase the for() loop speed because in my routine the calculations are too slow. Best regards. Rafael Barros de Rezende Cedeplar - Center for Development and Regional Planning Face, UFMG

[R] shell command

2008-06-12 Thread samitj
Hi, Can we execute a unix shell command from within R shell? thanks, Sam -- View this message in context: http://www.nabble.com/shell-command-tp17803089p17803089.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] problem with function rep

2008-06-12 Thread Julien Hunt
Hi I believe this should provide an example of the confusing behavior. Run this with t=100 for example: test=function(t){ x=c() while(sum(x)=t){ ###I simply generate some numbers from an exponential until the sum of these numbers gets to 100(without loss of generality)

[R] overall title

2008-06-12 Thread Trevor.A.Craney
I have a 2x2 plot set up using: par(mfrow=c(2,2)) I'd like to put an overall title on the page, but I cannot figure out how. Any ideas? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] shell command

2008-06-12 Thread Abhijit Dasgupta
Yes, see ?system samitj wrote: Hi, Can we execute a unix shell command from within R shell? thanks, Sam __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] shell command

2008-06-12 Thread Paul Hiemstra
samitj wrote: Hi, Can we execute a unix shell command from within R shell? thanks, Sam ?system hth, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +31302535773 Fax:

Re: [R] XML parameters to Column Headers for importing into a dataset

2008-06-12 Thread Martin Morgan
Hi Ajay -- ajay ohri [EMAIL PROTECTED] writes: Dear List, Do you know any way I can convert XML parameters into column headers. My In R, the XML package will help you... data is in a csv file with each row containing a xml form of data , and multiple parameters ( param1 data_val1

Re: [R] How to increase the for() loop speed?

2008-06-12 Thread Erik Iverson
13 minutes is a long time for a loop to simply send an email, what other calculations are going on? Rafael Barros de Rezende wrote: Dear R users, I would like to know if there is a way to increase the for() loop speed because in my routine the calculations are too slow. Best

Re: [R] overall title

2008-06-12 Thread Henrique Dallazuanna
See mtext: mtext(Title, outer = T, side = 3, line = -2) On Thu, Jun 12, 2008 at 12:38 PM, [EMAIL PROTECTED] wrote: I have a 2x2 plot set up using: par(mfrow=c(2,2)) I'd like to put an overall title on the page, but I cannot figure out how. Any ideas? [[alternative HTML version

Re: [R] overall title

2008-06-12 Thread Erin Hodgess
Please try this: z1 - rexp(100) z2 - rexp(100) z3 - rexp(100) z4 - rexp(100) par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) curve(dexp,from=0,to=5) hist(z1,main=first) hist(z2,main=second) hist(z3,main=third) mtext(Densities, outer = TRUE, cex = 1.5) Hope this helps. Sincerely, Erin On Thu,

Re: [R] About Mcneil Hanley test for a portion of AUC!

2008-06-12 Thread Frank E Harrell Jr
Dukka k.c. wrote: Dear all I am trying to compare the performances of several methods using the AUC0.1 and not the whole AUC. (meaning I wanted to compare to AUC's whose x axis only goes to 0.1 not 1) I came to know about the Mcneil Hanley test from Bernardo Rangel Tura and I referred to the

Re: [R] How to increase the for() loop speed?

2008-06-12 Thread Rafael Barros de Rezende
My routine is on Financial Econometrics (Yield Curve Modeling). It is very intensive. And I have heard that the for() loop speed could be increased with a command. I want to know if there a way to do it. Best regards. Rafael Barros de Rezende -- Original Message

Re: [R] overall title

2008-06-12 Thread Prof Brian Ripley
?title, see 'outer' (and you will need to make room for an outer margin). This is described in 'An Introduction to R' (and in all good books on R). On Thu, 12 Jun 2008, [EMAIL PROTECTED] wrote: I have a 2x2 plot set up using: par(mfrow=c(2,2)) I'd like to put an overall title on the page,

Re: [R] How to increase the for() loop speed?

2008-06-12 Thread Erik Iverson
We would certainly need more information about your function to offer any specific advice, therefore I'll fall back on the general. First there is no command that will increase a for loop speed, it is not as if they are artificially slowed down. In general, you may be able to do whatever it

[R] adding horizontal lines to a trellis plot

2008-06-12 Thread Blanchard, Suzette
I would like to add two horizontal lines representing acceptible drug levels to a trellis plot. I tried using abline and I get an error that plot.new has not been called. See below. xyplot(FK~WEEK|Event1/MRN, data=FKdat.o1) abline(h=5) abline(h=10) Error in int_abline(a = a, b = b, h = h, v

Re: [R] adding horizontal lines to a trellis plot

2008-06-12 Thread Bert Gunter
Please read about panel functions in ?xyplot and ?panel.abline In particular, you do this sort of thing in panel functions where you must use grid graphics functions or various lattice forms (wrappers) thereof. The standard graphics constructions will not work (as you found out).Suggested

Re: [R] How to increase the for() loop speed?

2008-06-12 Thread jim holtman
The first thing to do is to run Rprof and determine where time is being spent. It may be that it is one of the functions that you are calling inside the loop that is taking the majority of time and if that is the case, there may not be any improvement other than coming up with a different

[R] save workspace while running R on a cluster

2008-06-12 Thread Manisha Brahmachary
Hello, I have a question about running R in a cluster environment. The shell script I am running looks like this: #!/bin/bash cd /nfs/apollo/2/c2b2/users/mb0001/Data /nfs/apollo/1/shares/software/core_facility/local/x86_64_rocks/R/current/bin/ R --save calculate.R script.out I have

Re: [R] save workspace while running R on a cluster

2008-06-12 Thread milton ruser
Hi Manisha, How about you incluse something like this on your script.R: setwd(/your/full/working/directory) # ?setwd save.image()# or save.image(your_workspace.RDA). By the way, I don´t know if you added the line below to run in background: R --save calculate.R script.out May be the

[R] alternative to matching/merge?

2008-06-12 Thread Lana Schaffer
Greetings, I am doing matching/merge for a table (40919x3) to data which is in the form of a list of 1268 data.frames. Using lapply this is taking ~5 minutes. I know that the match/merge functions are time consuming, so is there an alternative to this accomplish this goal? is lapply not

[R] Subset in cast: compact form?

2008-06-12 Thread Agustin Lobo
Hi! How can I subset several variables in cast? For example, I can do it for one, (ie, ph): cast(am, organismo +arriba ~ variable,subset=variable==ph,mean,na.rm=T) For selecting ph, temperature and Ba I'm using: cast(am, organismo +arriba ~ variable,subset=variable==ph variable==temperature|

Re: [R] Subset in cast: compact form?

2008-06-12 Thread hadley wickham
On Thu, Jun 12, 2008 at 2:27 PM, Agustin Lobo [EMAIL PROTECTED] wrote: Hi! How can I subset several variables in cast? For example, I can do it for one, (ie, ph): cast(am, organismo +arriba ~ variable,subset=variable==ph,mean,na.rm=T) For selecting ph, temperature and Ba I'm using:

Re: [R] overall title

2008-06-12 Thread William Pepe
Check out this previous post from years ago. http://tolstoy.newcastle.edu.au/R/help/00a/2237.html Bill Date: Thu, 12 Jun 2008 10:38:03 -0500 From: [EMAIL PROTECTED] To: r-help@r-project.org Subject: [R] overall title I have a 2x2 plot set up using: par(mfrow=c(2,2)) I'd like to put an

[R] Rprintf and C stack usage is too close to the limit

2008-06-12 Thread Youyi Fong
Hi, I would appreciate if someone could comment on this problem I am experiencing. I am writing a C++ program to be called from R. In this program, there is a verbose switch that decides whether to print some debugging info using Rprintf. On windows, things work ok. On linux, things are fine in

[R] Problem with rowMeans()

2008-06-12 Thread ss
Hi all, I have a matrix called 'data', which looks like: data[1:4,1:4] Probe_ID Gene_Symbol M1601 M1602 1 A_23_P10586213CDNA73-1.60.16 2 A_23_P76435 15E1.20.180.59 3 A_24_P402115 15E1.21.63

[R] numbers as part of long character

2008-06-12 Thread Hua Li
Hi, I'm looking for some way to pick up the numbers which are contained and buried in a long character. For example, outtree.new=(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C:17139.21); num.char =

Re: [R] Problem with rowMeans()

2008-06-12 Thread Erik Iverson
Hello - ss wrote: Hi all, I have a matrix called 'data', which looks like: data[1:4,1:4] Probe_ID Gene_Symbol M1601 M1602 1 A_23_P10586213CDNA73-1.60.16 2 A_23_P76435 15E1.20.180.59 3 A_24_P402115 15E1.2

Re: [R] Problem with rowMeans()

2008-06-12 Thread ss
Dear Erik, Thanks! The 'data' is matrix but all(apply(data[,3:85], 2, class) == numeric) is false. class(data) [1] matrix a- rowMeans(data[,3:85],na.rm = TRUE) Error in rowMeans(data[, 3:85], na.rm = TRUE) : 'x' must be numeric all(apply(data[,3:85], 2, class) == numeric) [1] FALSE What

Re: [R] Problem with rowMeans()

2008-06-12 Thread Wacek Kusnierczyk
ss wrote: Hi all, I have a matrix called 'data', which looks like: data[1:4,1:4] Probe_ID Gene_Symbol M1601 M1602 1 A_23_P10586213CDNA73-1.60.16 2 A_23_P76435 15E1.20.180.59 3 A_24_P402115

Re: [R] numbers as part of long character

2008-06-12 Thread Marc Schwartz
on 06/12/2008 03:46 PM Hua Li wrote: Hi, I'm looking for some way to pick up the numbers which are contained and buried in a long character. For example, outtree.new=(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C:17139.21); num.char =

Re: [R] Problem with rowMeans()

2008-06-12 Thread Erik Iverson
ss wrote: Dear Erik, Thanks! The 'data' is matrix but all(apply(data[,3:85], 2, class) == numeric) is false. class(data) [1] matrix a- rowMeans(data[,3:85],na.rm = TRUE) Error in rowMeans(data[, 3:85], na.rm = TRUE) : 'x' must be numeric all(apply(data[,3:85], 2, class) == numeric)

[R] Problems with mars in R in the case of nonlinear functions

2008-06-12 Thread Janne Huttunen
Hi, I'm trying to use mars function in R to interpolate nonlinear multivariate functions. However, it seems that mars gives me a fit which uses only very few basis function and it underfits very badly. For example, I have tried the following code to test mars: require(mda) f -

Re: [R] numbers as part of long character

2008-06-12 Thread Charilaos Skiadas
On Jun 12, 2008, at 5:06 PM, Marc Schwartz wrote: on 06/12/2008 03:46 PM Hua Li wrote: Hi, I'm looking for some way to pick up the numbers which are contained and buried in a long character. For example, outtree.new=(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C: 17139.21); num.char =

[R] rJava classpath issues

2008-06-12 Thread Munir, Danish
I'm having some issues with getting my own jars to work properly with rJava. Bear with me as I explain my scenario: I have a java package called rjbridge, with the following classes: RJBridge.class ObjectInfo.class Each of the classes has the following line on top: package

Re: [R] numbers as part of long character

2008-06-12 Thread Hua Li
Thanks, Marc and Haris! I didn't know the values of the numbers beforehand, so the scan method won't work, but [^+-\\d.]+ will do! And Haris, I didn't intend to keep the information of which number is B, which is C etc when asking the question, as I had a tedious way to do it (use strspilt

Re: [R] numbers as part of long character

2008-06-12 Thread Hua Li
Oh, Sorry, Marc. The scan method does work! Hua --- On Thu, 6/12/08, Charilaos Skiadas [EMAIL PROTECTED] wrote: From: Charilaos Skiadas [EMAIL PROTECTED] Subject: Re: [R] numbers as part of long character To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], r-help@r-project.org Date: Thursday,

[R] Getting Batch mode to continue running a script after running into errors

2008-06-12 Thread Josh
I'm invoking R in batch mode from a bash script as follows: R --no-restore --no-save --vanilla $TARGET/$directory/o2sat-$VERSION.R $TARGET/$directory/o2sat-$VERSION.Routput When R comes across some error in the script however it seems to halt instead of running subsequent lines in the script:

Re: [R] numbers as part of long character

2008-06-12 Thread Charilaos Skiadas
On Jun 12, 2008, at 6:34 PM, Hua Li wrote: Thanks, Marc and Haris! I didn't know the values of the numbers beforehand, so the scan method won't work, but [^+-\\d.]+ will do! And Haris, I didn't intend to keep the information of which number is B, which is C etc when asking the question,

Re: [R] Problem with rowMeans()

2008-06-12 Thread Wacek Kusnierczyk
ss wrote: Thank you very much, Wacek! It works very well. But there is a minor problem. I did the following: data - read.table('E-TABM-1-processed-data-1342561271_log2_with_symbols.txt', +row.names = NULL ,header=TRUE, fill=TRUE) looks like you have a data frame, not a matrix dim(data)

Re: [R] Problem with rowMeans()

2008-06-12 Thread ss
Hi Wacek, Yes, data is data frame not a matrix. is.numeric(data[3]) [1] FALSE But I looked at the column 3 and it looks okay though. There are few NAs and I did find anything strange. Any suggestions? Thanks, Allen On Thu, Jun 12, 2008 at 7:01 PM, Wacek Kusnierczyk [EMAIL

Re: [R] Generate Random Samples

2008-06-12 Thread Moshe Olshansky
To answer your specific question, you can use mvrnorm (from MASS, i.e. library(MASS)) to generate each component. To generate a mixture with three components (Prob(1 st component) = p1, Prob(2nd component) = p2, Prob(3rd component) = p3, p1+p2+p3=1), you can generate a uniformly distributed

Re: [R] Problem with rowMeans()

2008-06-12 Thread Erik Iverson
ss wrote: Hi Wacek, Yes, data is data frame not a matrix. is.numeric(data[3]) [1] FALSE what is class(data[3]) But I looked at the column 3 and it looks okay though. There are few NAs and I did find anything strange. Any suggestions? Thanks, Allen On Thu, Jun 12, 2008 at

Re: [R] Problem with rowMeans()

2008-06-12 Thread ss
It is: data - read.table('E-TABM-1-processed-data-1342561271_log2_with_symbols.txt', row.names = NULL ,header=TRUE, fill=TRUE) class(data[3]) [1] data.frame And if I try to use as.matrix(read.table()), I got: data

  1   2   >