R语言用aggregate函数分组求中位数、平均数等报错,如何解决?

问题遇到的现象和发生背景

R语言用aggregate函数分组求中位数、平均数等报错
想计算两组各自的身高中位数、四分位间距、平均数、标准差,结果报错如图。请教各位,我的问题出在哪里,以及该如何改?谢谢各位!

用代码块功能插入代码,请勿粘贴截图
###一、设置当前工作路径
setwd(".....")【省略地址,问题不在这】
###二、读取数据
data <- read.table("baseline_height_R.csv",header=TRUE,sep=",")
data
###三、秩和检验-身高height
wilcox.test(height~group,data = data)
###四、描述性分析
#按照group分组(队列1 or 队列2)计算每组结果的中位数、四分位间距、平均数、标准差
aggregate(height,by=list(group),FUN=median)
aggregate(height,by=list(group),FUN=quantile)
aggregate(height,by=list(group),FUN=mean)
aggregate(height,by=list(group),FUN=sd)
#绘图
ggboxplot(data, x = "group", y = "height", 
          color = "group", palette = c("#ED0000FF", "#00468BFF"),
          ylab = "Height", xlab = "Groups")

运行结果及报错内容
> ###四、描述性分析
> #按照group分组(队列1 or 队列2)计算每组结果的中位数、四分位间距、平均数、标准差
> aggregate(height,by=list(group),FUN=median)
  Group.1    x
1       1  170
2       2 
Warning message:
In mean.default(sort(x, partial = half + 0L:1L)[half + 0L:1L]) :
  参数不是数值也不是逻辑值:回覆NA
> aggregate(height,by=list(group),FUN=quantile)
Error in (1 - h) * qs[i] : non-numeric argument to binary operator
> aggregate(height,by=list(group),FUN=mean)
  Group.1  x
1       1 NA
2       2 NA
Warning messages:
1: In mean.default(X[[i]], ...) : 参数不是数值也不是逻辑值:回覆NA
2: In mean.default(X[[i]], ...) : 参数不是数值也不是逻辑值:回覆NA
> aggregate(height,by=list(group),FUN=sd)
  Group.1        x
1       1       NA
2       2 7.866268
Warning message:
In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
  NAs introduced by coercion
> View(data)
> class(height)
[1] "character"
> >as.numeric(height)
Error: unexpected '>' in ">"

我的解答思路和尝试过的方法

我看了下可能是字符串的问题,但用as.numeric函数转为数值型也不成功,报错如上。

我想要达到的结果

想知道问题在哪,以及如何改正。或者有没有更好的方法做出来两组的描述性分析结果。谢谢!