1

Here is my data:

> factors.table
# A tibble: 10 x 7
   var          nfacts   corr corrAbs   l50   l70   l75
   <chr>        <chr>   <dbl>   <dbl> <dbl> <dbl> <dbl>
 1 mpg          127     0.837   0.837     1     1     1
 2 cylinders    5      -0.759   0.759     1     1     1
 3 displacement 81     -0.753   0.753     1     1     1
 4 horsepower   93     -0.667   0.667     1     0     0
 5 weight       346    -0.758   0.758     1     1     1
 6 acceleration 95      0.347   0.347     0     0     0
 7 year         13      0.430   0.430     0     0     0
 8 origin       3       0.514   0.514     1     0     0
 9 name         301     0.264   0.264     0     0     0
10 mpg01        2       1       1         1     1     1

I am trying to compute the sums of rows 5-7 as suggested here (Efficiently sum across multiple columns in R) but I am getting this error:

> rowSums(factors.table[,5:7])
Error in weekSum(dat, start, end, c) :
argument "start" is missing, with no default

I have never seen weekSum before and it doesn't appear in R when I search help(weekSum).

therickster
  • 111
  • 6
  • 1
    `rowSums` is from `base R`. Can you try on a fresh R session without loading any other packages and do this again – akrun Jan 07 '23 at 02:42
  • It doesn't have any issue on tibble `iris1 <- as_tibble(iris); > rowSums(iris1[1:4])# [1] 10.2 9.5 9.4 9.4 ...` – akrun Jan 07 '23 at 02:46
  • 1
    Can you show the `dput(head(factors.table, 6))` – akrun Jan 07 '23 at 02:47
  • 3
    Or try explicitly specifying base (if you have pother packages loaded) with `base::rowSums(factors.table[,5:7])` – jpsmith Jan 07 '23 at 03:00
  • 1
    for some reason my comment got deleted. but thank you @jpsmith this was very helpful! – therickster Jan 08 '23 at 00:52

0 Answers0