| [.AmigaBasic {AmigaFFH} | R Documentation |
Extract or replace lines of Amiga Basic code
Description
Extract or replace lines of Amiga Basic code
Usage
## S3 method for class 'AmigaBasic'
x[i]
## S3 replacement method for class 'AmigaBasic'
x[i] <- value
## S3 method for class 'AmigaBasic'
x[[i]]
## S3 replacement method for class 'AmigaBasic'
x[[i]] <- value
Arguments
x |
An |
i |
In case of |
value |
A |
Details
Extract or replace specific lines in an AmigaBasic()-class object.
Value
The extraction method returns an AmigaBasic() object based in the lines selected with i.
The replacement method returns an AmigaBasic() object with the selected lines replaced with value.
Author(s)
Pepijn de Vries
See Also
Other AmigaBasic.operations:
AmigaBasic.reserved(),
AmigaBasicBMAP,
AmigaBasic,
as.AmigaBasicBMAP(),
as.AmigaBasic(),
as.character(),
check.names.AmigaBasic(),
names.AmigaBasic(),
rawToAmigaBasicBMAP(),
rawToAmigaBasic(),
read.AmigaBasicBMAP(),
read.AmigaBasic(),
write.AmigaBasic()
Examples
## Not run:
## First generate a few lines of Basic code:
bas <- as.AmigaBasic(c(
"LET a = 1",
"a = a + 1",
"PRINT \"a now equals\";a",
"INPUT \"clear screen (y/n)? \", b$",
"IF UCASE$(b$) = \"Y\" THEN CLS"
))
## Select only lines 4 and 5:
bas[4:5]
## use negative indices to deselect specific lines.
## deselect line 2:
bas[-2]
## replace line 2
bas[2] <- "a = a + 2"
## You can also use AmigaBasic class object as replacement
bas[2] <- as.AmigaBasic("a = a + 3")
## single lines can also be selected with '[['
bas[[2]]
## End(Not run)