我正在尝试将具有值要素的数组拆分为分号和字符串,如何将其拆分为更多的数组?
half_instances<-c(0,5,2)
Ts<-c(1,2,3)
xpairs<-c(Ts, rep(5,length(half_instances)))
ypairs<-c(Ts,half_instances)
xpairs #1 2 3 5 5 5
ypairs #0 5 2 1 2 3
points <- cbind(Ts, half_instances)
# Set up basic plot
plot(points, type="l")
# Create the outside polygon...
maxX <- max(points[, 1])
minX <- min(points[, 1])
maxY <- max(points[, 2])
minY <- min(points[, 2])
borderPoints <- matrix(c(minX,minY, minX,maxY, maxX,maxY), ncol=2, byrow=TRUE)
linePoints <- points[nrow(points):1, ]
outside <- rbind(borderPoints, linePoints)
# ...and plot it in blue
polygon(outside, border=NA, col='blue')
# Create the inside polygon and plot it in red
inside <- rbind(points, pts[1,])
polygon(inside, col='red', border=NA)
# Redraw the initial line if you want
lines(points, col='black', lwd=2)
我的预期输出是分号
$computers =array( "computer;DT-11;12;568,36;23", "Samsung; RS-6000; 232; 345;456", "Hewlett Packard; 1212; 232; 34", "Toshiba; 20; 45; 60;Sony; Vaio 123; 45; 123" );
,我将得到:
";"
但是array1("computer;DT-11;12;568,36;23 ") array2...
仅将字符串拆分,因此我希望它将数组拆分为更多的小数组