Question:
The root cause is the wrong data type.
The factor type has no max method
#create a vector of class vector
factor_vector <- as.factor(c(1, 7, 12, 14, 15))
#attempt to find max value in the vector
max(factor_vector)
#Error in Summary.factor(1:5, na.rm = FALSE) :
# 'max' not meaningful for factors
Solution:
Convert to numeric value or string, here convert to numeric value.
mydata$value<-as.numeric(mydata$value)
is.numeric(mydata$value)
#convert factor vector to numeric vector and find the max value
new_vector <- as.numeric(as.character(factor_vector))
max(new_vector)
#[1] 15
Full error:
#create a vector of class vector factor_vector <- as.factor(c(1, 7, 12, 14, 15)) #attempt to find max value in the vector max(factor_vector) #Error in Summary.factor(1:5, na.rm = FALSE) : # 'max' not meaningful for factors
Other (numeric value, string, date type can be the maximum value)
Numeric value, string and date type can all be the maximum value, and similarly, the minimum value can be obtained.
numeric_vector <- c(1, 2, 12, 14)
max(numeric_vector)
#[1] 14
character_vector <- c("a", "b", "f")
max(character_vector)
#[1] "f"
date_vector <- as.Date(c("2019-01-01", "2019-03-05", "2019-03-04"))
max(date_vector)
#[1] "2019-03-05"
Read More:
- [Solved] Error in Summary.factor ‘sum’ not meaningful for factors
- Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least
- Tensorflow error: InvalidArgumentError: indices[data_index] = data_value is not in [0, max_embedding_size)
- [Solved] Kafka Error: InvalidReplicationFactorException: Replication factor:
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- [Solved] std::max() error C2589: ‘(‘ : illegal token on right side of ‘::‘
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- [Solved] error: taking address of temporary array av_make_error_string((char[AV_ERROR_MAX_STRING_SI…
- The method println(boolean) in the type PrintStream is not applicable for the arguments (void) Error
- Error: could not find function … in R [How to Solve]
- [Solved] MindSpore Error: Should not use Python in runtime
- The tree component in easyUI does not display data or displays undefined solutions
- The @RestControllerAdvice annotation does not take effect in the Springboot project
- [Solved] hive Caused by: MetaException(message:Version information not found in metastore. )
- [Solved] MindSpore Error: ReduceMean in the Ascend environment does not support inputs of 8 or more dimensions
- C++ new types may not be defined in a return type Error?
- [Solved] AS Warning: String literal in setText can not be translated. Use Android resources instead.
- [Solved] error: ‘CV_GRAY2BGR’ was not declared in this scope
- Bin File Programming Failed, could not find core in coresight setup, erase error
- [Solved] Flink Hadoop is not in the classpath/dependencies