Question: Is it possible to remove everything before special characters including this character in `array` ?

For example, `SUBSTR()` function is used in string

```
$a= ('1-160');
echo substr($a,strpos($a,'-')+1);
//output is 160

```

Any function for array like `SUBSTR()`? (least priority to `preg_replace`).

Here array is structured as following example, every index consists `int` value + `hyphen(-)`

```
$a= array('1-160','2-250', '3-380');

```

I need to change removing every values before hyphen and hyphen also

```
$a= array('160','250', '380');

```

Actually my requirement is to sum all values after the `hyphen(-)` in array. If `hyphen(-)` can be removed, it can be done as 

```
echo array_sum($a);
//output is 790

```

but, because of the special characters, I am generating output as following way. 

```
$total = 0;
foreach($a AS $val){
  $b = explode('-',$val);
  $total += $b[1];
}
echo $total;
//output is 790

```

I am searching short and fast method as possible.

Answer: 
Buddy you are converting datetime column into ts().
therefore it is giving result like this.convert only aep column

your code 

```
       hour_data <- ts(hourly[,c('time','AEP_MW')]) 

```

instead of above code write like this

```
       hour_data <- ts(hourly$AEP_MW) 

```
I am not sure why you need the `time` to be included int `ts` object. Using the following:

```
hour_data <- ts(hourly[,c('AEP_MW')])

```

will give an output similar to this:

```
Time Series:
Start = 1 
End = 11 
Frequency = 1 
      AEP_MW
 [1,]  13478
 [2,]  12865
 [3,]  12577
 [4,]  12517
 [5,]  12670
 [6,]  13038
 [7,]  13692
 [8,]  14297
 [9,]  14719
[10,]  14941
[11,]  15184

```

Now, if you `plot(hour_data)` this, you would get this:

[![enter image description here](https://i.stack.imgur.com/TrC5Y.png)](https://i.stack.imgur.com/TrC5Y.png)

But I guess you desire to show the `time` in the x-axis. You may do so as follows:

```
plot(hour_data, xaxt = "n", ylab="AEP_MW")
axis(1, at=rownames(hourly), labels=hourly$Datetime)

```

Which will give you this plot:

[![enter image description here](https://i.stack.imgur.com/c8r1V.png)](https://i.stack.imgur.com/c8r1V.png)

Hope this helps.