필터 지우기
필터 지우기

Categorical2Num in a table

조회 수: 2 (최근 30일)
BingoIngo
BingoIngo 2019년 5월 9일
답변: Peter Perkins 2019년 5월 14일
I have a table with categorical data in it. In order to calculate average etc. I need to convert it to num. Does anyone know the syntax?
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 5월 9일
YourTable.NewVariable = double(YourTable.CategoricalVariable)
It is possible to replace the variable but you have to build a table to do it because of the change of data type.
Are you sure you need numeric? findgroups will probably provide you with everything you need in practice.

댓글을 달려면 로그인하십시오.

답변 (1개)

Peter Perkins
Peter Perkins 2019년 5월 14일
If you are computing the average of a numeric variable using a cate3gorical variable to group your data, then you should not need to convert anything.
But your description sounds like you are trying to compute the average of a categorical variable. That's a contradiction in terms. It's like computing the mean of text data. Mode, sure (in which case you don't need to convert), median, yes, if it's ordinal. Mean? Something is wrong.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by