我有以下变量{
"key": "GEnFcIB5UBScbwrM9OfBqYzY0/8=\r\n",
}
:
Request {#42
#json: ParameterBag {#24
#parameters: array:1 [
"key" => "GEnFcIB5UBScbwrM9OfBqYzY0/8="
]
}
...
#content: "{"key":"GEnFcIB5UBScbwrM9OfBqYzY0/8=\r\n"}",
...
}
还有另一个变量#!/bin/bash
read -p "search string:" muster
saved="$IFS"
IFS=$'\n'
for i in $(grep -i $muster $1); do
# $i now contains the line of which did match the search string
done
IFS="$saved"
:
pp
我想将a = c(1,2,3,4)
b = c(45,4,3,2)
c = c(34,23,12,45)
pp = cbind(a,b,c)
中每一列的总和除以qq
的总和,以使输出答案是一个向量:
qq = c(100,200,330,444)
我是R的新手,正在寻找进行这种除法的最佳方法。
答案 0 :(得分:3)
您可以尝试:
colSums(pp) / sum(qq)
a b c
#0.009310987 0.050279330 0.106145251
答案 1 :(得分:1)
tmp <- colSums(pp)
tmp/sum(qq)
a b c 0.009310987 0.050279330 0.106145251