[R] writing R output to a specific file type
Is it possible to write R-output to a specific file type? Specifically is it possible to write to a specific cell in an MS Excel spreadsheet? Thanks, Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to get f(x)=___ from a piecwise function
Thanks. the approxfun command works great --matches exactly with computing each point-to-point slope Eric - Original Message - From: jim holtman To: Eric C. Jennings Cc: R-help Sent: Saturday, February 25, 2006 9:27 PM Subject: Re: [R] how to get f(x)=___ from a piecwise function ?approxfun x- c(-100.4, 32.0, 99.8, 200.2, 300.6, 399.8, 500.0, 600.0, 699.6, 799.6, + 899.8) y- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2) x.f - approxfun(x,y) x.f(356) [1] -0.1532258 On 2/25/06, Eric C. Jennings [EMAIL PROTECTED] wrote: From actual real-world readings, I have two vectors: x- c(-100.4, 32.0, 99.8, 200.2, 300.6, 399.8, 500.0, 600.0, 699.6, 799.6, 899.8) y- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2) which, in the usual way constitute a continuous piecewise function. What I want to do is find an easy method to get at f(x) for some x I have NOT specified in the above vector. For example I want f(356). I have already put the time and effort in to write a program to compute this by breaking the function into the various pieces and computing the slopes of the individual lines etc. etc. I am just looking to find an easier method. Thank you for your help. Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 646 9390 What the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to get f(x)=___ from a piecwise function
From actual real-world readings, I have two vectors: x- c(-100.4, 32.0, 99.8, 200.2, 300.6, 399.8, 500.0, 600.0, 699.6, 799.6, 899.8) y- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2) which, in the usual way constitute a continuous piecewise function. What I want to do is find an easy method to get at f(x) for some x I have NOT specified in the above vector. For example I want f(356). I have already put the time and effort in to write a program to compute this by breaking the function into the various pieces and computing the slopes of the individual lines etc. etc. I am just looking to find an easier method. Thank you for your help. Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Warnings about user error (was read.table error)
Prof. Pipley First let me thank you for your help. Second, you are correct, I should not have used the word error in my subject line. Regarding the lack of detach(), I simply forgot to include that in my email. The warnings regarding the incomplete final line do not seem to want to go away. The masking messages The following object(s) are masked from ovendata ( position 4 ) : D Eight Five Four One Seven Three Two do go away if I use: rm(list=ls(all=TRUE)) thanks, Eric - Original Message - From: Prof Brian Ripley [EMAIL PROTECTED] To: Eric C. Jennings [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Wednesday, December 07, 2005 11:05 PM Subject: Re: [R] Warnings about user error (was read.table error) I see no error here, let alone an error in read.table as claimed in your subject line. The posting guide does specifically ask `Use an informative subject line'. Please distinguish warnings about _your_ usage from errors in R. The first warning is that R fixed up an error in your file: it is missing a newline at the end of the last line (we can't see that in your listing). The remaining warnings come from attach() and say you have already repeatedly attach()ed ovendata. Learn to use detach() to match attach(). Also, in attaching ovendata you mask the function D in package stats, which is probably OK as you are not using it, and your D is a not a function. On Wed, 7 Dec 2005, Eric C. Jennings wrote: Hey, Once again I ask for some quick help. Here is some code: ovendata- read.table(ovens.dat,header=TRUE) attach(ovendata) print(ovendata) Here is the .dat file: DOne Two Three FourFiveSeven Eight 1130254 252 375 384 252 375 876 127 250 250 384 386 251 378 875 Here is the R Console output: ovendata- read.table(ovens.dat,header=TRUE) Warning message: incomplete final line found by readTableHeader on 'ovens.dat' attach(ovendata) The following object(s) are masked from ovendata ( position 3 ) : D Eight Five Four One Seven Three Two The following object(s) are masked from ovendata ( position 4 ) : D Eight Five Four One Seven Three Two The following object(s) are masked from ovendata ( position 5 ) : Eight Five Four One Seven Three Two The following object(s) are masked from package:stats : D print(ovendata) D One Two Three Four Five Seven Eight 1 1130 254 252 375 384 252 375 876 2 127 250 250 384 386 251 378 875 I've never seen anything like theis before. What's going on? Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] read.table error
Hey, Once again I ask for some quick help. Here is some code: ovendata- read.table(ovens.dat,header=TRUE) attach(ovendata) print(ovendata) Here is the .dat file: DOne Two Three FourFiveSeven Eight 1130254 252 375 384 252 375 876 127 250 250 384 386 251 378 875 Here is the R Console output: ovendata- read.table(ovens.dat,header=TRUE) Warning message: incomplete final line found by readTableHeader on 'ovens.dat' attach(ovendata) The following object(s) are masked from ovendata ( position 3 ) : D Eight Five Four One Seven Three Two The following object(s) are masked from ovendata ( position 4 ) : D Eight Five Four One Seven Three Two The following object(s) are masked from ovendata ( position 5 ) : Eight Five Four One Seven Three Two The following object(s) are masked from package:stats : D print(ovendata) D One Two Three Four Five Seven Eight 1 1130 254 252 375 384 252 375 876 2 127 250 250 384 386 251 378 875 I've never seen anything like theis before. What's going on? Eric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] values in between
Hey there I have two vectors: y- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2) In the vector y, I want to access (in the order given) all of the values in between each of the specific values of given. I understand subsetting with y[i], but how do I get to ssomewhere in between -0.6 and 0.2? Thanks Eric Jennings [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] chronological ordering of factor in lm() and plot()
Thanks That works great. Eric - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Sent: Friday, April 15, 2005 10:42 PM Subject: RE: [R] chronological ordering of factor in lm() and plot() First put day.names - c(sun, mon, tue, wed, thu, fri, sat) then days - factor(as.character(days), levels = day.names) will ensure the ordering you want. Bill Venables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric C. Jennings Sent: Saturday, 16 April 2005 2:29 PM To: R-help Subject: [R] chronological ordering of factor in lm() and plot() I am trying to do some basic regression and ANOVA on cycle times (numeric vectors) across weekdays (character vector), where I have simply labelled my days as: days- c(mon,tue,wed...etc). (NOTE: There are actually multiple instances of each day, and the data is read-in from a .dat file.) I have no trouble at all with the actual number crunching, It is the proper ordering of the factor that I am asking about. R first alphabetizes it(fri,mon,thu...) before doing the work of lm(), aov() and especially plot(). I have tried as.ordered(factor( )), but that doesn't do anything. If I re-assign levels() in the way that I want, that just renames the the levels of the factor but does not reorder it internally. I've looked at chron(), but that seems to entail using a numeric vector instead of a character vector. How can I get it to properly (chronologically) order the factor. (In some ways I'm thinking that all I can do is: days- c(a.mon,b.tues,c.wed...etc) Thanks for all that you can do Eric Jennings [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] chronological ordering of factor in lm() and plot()
I am trying to do some basic regression and ANOVA on cycle times (numeric vectors) across weekdays (character vector), where I have simply labelled my days as: days- c(mon,tue,wed...etc). (NOTE: There are actually multiple instances of each day, and the data is read-in from a .dat file.) I have no trouble at all with the actual number crunching, It is the proper ordering of the factor that I am asking about. R first alphabetizes it(fri,mon,thu...) before doing the work of lm(), aov() and especially plot(). I have tried as.ordered(factor( )), but that doesn't do anything. If I re-assign levels() in the way that I want, that just renames the the levels of the factor but does not reorder it internally. I've looked at chron(), but that seems to entail using a numeric vector instead of a character vector. How can I get it to properly (chronologically) order the factor. (In some ways I'm thinking that all I can do is: days- c(a.mon,b.tues,c.wed...etc) Thanks for all that you can do Eric Jennings [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html