Displaying 3 results from an estimated 3 matches for "var_str".
Did you mean:
val_str
2010 Sep 24
1
Some questions about string processing
Hi all
A couple of questions about string processing from someone who has only scratched the surface so far.
1) I am wanting to send some strings into a function to allow flexibility inside. My first idea has been e.g.
auto_io <- function( var_string, factors ) {
# e.g. var_string sent as "test_file.txt" factors sent as "x1 + x2 + x3"
# input
data_name <- get( var_string )
# term_list <- get( factors )
resp_data <- read.table( data_name, header = TRUE )
# fit
temp_model <- lm( y ~...
2008 Aug 04
1
subset inside a lattice plot using panel.lines
...ent call 'row'
created like this and checked to be OK:
row <- seq( len=length( variable1 ) )
...so I just want to plot the two subsets where row <= 387 and where
row > 387. None of these work properly:
plots both over each other in correct colours
opt_plot2 <- function( var_string, c, units ) {
print( xyplot( get(var_string) ~ variable1 | variable2, panel =
function( x, y, ... ) {
panel.xyplot( x, y, type ="n", ... )
panel.grid( h=-1, v=-1, lty=3, lwd=1, col="grey" )
panel.lines( x, y, col = "red", subset = row <= 387 )
panel.lin...
2008 Jul 01
3
dev.off() inside a function & other glitches
...d finally call dev.off() to write to the file.
This works well apart from the fact that the last plot does not get
sent to the file unless I comment out dev.off() and then apply it in
the console afterwards instead:
plot_stuff( ...); dev.off()
The device is opened like this:
pdf( paste( var_string, ".pdf", sep="" ), onefile=TRUE, paper="a4r",
width=9, height=6.5 )
Also, if I try to send two different xyplots after the loop only the
last one ever gets written to the file, whether or not I apply the
dev.off() trick above.
Any thoughts on why this stuff...