From: John Fox <jfox_at_mcmaster.ca>

Date: Tue 07 Feb 2006 - 10:33:04 EST

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 Received on Tue Feb 07 10:40:17 2006

Date: Tue 07 Feb 2006 - 10:33:04 EST

Dear Richard,

> -----Original Message-----

*> From: r-help-bounces@stat.math.ethz.ch
**> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Richard Evans
**> Sent: Monday, February 06, 2006 4:35 PM
**> To: r-help@stat.math.ethz.ch
**> Subject: [R] novice questions about programming in "R"
**>
**> folks,
**>
**> I have been struggling with the "R" documentation for too
**> long now and I need a simple answer on two questions. The
**> documentation does not have adequate examples. Please help.
**>
**> given two equal vector lists:
**> A <- c(0,1,2,3)
**> B <- c(5,6,7,8)
**>
**> [Question #1]
**> how do I dump them to a text file with the following format:
**> ------------------------------------------------------------
**> [line 1] 0.0000000 5.0000000
**> [line 2] 1.0000000 6.0000000
**> [line 3] 2.0000000 7.0000000
**> [line 4] 3.0000000 8.0000000
**> ------------------------------------------------------------
*

One way to do this is

Data <- cbind(A,B)

rownames(Data) <- paste("[line ", 1:4, "]", sep="")
write.table(formatC(Data, digits=7, format="f"),

file="c:/temp/test.txt", col.names=FALSE, quote=FALSE)

[Note that the two vectors are not lists and are not equal. If you don't really want the line numbers in the file, then omit the second command and use the argument row.names=FALSE to write.table().]

*>
**> [Question #2]
*

> ------------------------------------------------------------

*> how do you make log-log plot that looks like it was plotted
**> on log-log graph paper?
**> ------------------------------------------------------------
**>
*

plot(x, y, log="xy")

[I assume that you don't want the graph-paper grid, though you could add that with abline(h=values, v=values, col="gray") if you do.]

I hope this helps,

John

> many thanks,

*> - revansx
**>
**> ______________________________________________
**> 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 Received on Tue Feb 07 10:40:17 2006

*
This archive was generated by hypermail 2.1.8
: Wed 08 Feb 2006 - 01:36:40 EST
*