**Question:**

The root cause is the wrong data type.

The factor type has no sum method

```
#create a vector of class vector
factor_vector <- as.factor(c(1, 7, 12, 14, 15))
#attempt to find min value in the vector
sum(factor_vector)
Error in Summary.factor(1:5, na.rm = FALSE) :
‘sum’ not meaningful for factors
```

**Solution:**

Convert to numeric values and use the as.numeric function.

mydata$value<-as.numeric(mydata$value)

is.numeric(mydata$value)

```
#convert factor vector to numeric vector and find the min value
new_vector <- as.numeric(as.character(factor_vector))
sum(new_vector)
#[1] 49
```

Complete error:

#create a vector of class vector factor_vector <- as.factor(c(1, 7, 12, 14, 15)) #attempt to find min value in the vector sum(factor_vector) Error in Summary.factor(1:5, na.rm = FALSE) : ‘sum’ not meaningful for factors

Other (the minimum value can be obtained for numeric value, string and date type)

Numeric value, string and date type can all be maximized. Similarly, the maximum 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"
```

The R language is called R partly because of the names of the two R authors (Robert gentleman and Ross ihaka) and partly because of the influence of Bell Labs s language (called the dialect of s language).

R language is a mathematical programming language designed for mathematical researchers. It is mainly used for statistical analysis, drawing and data mining.

If you are a beginner of computer programs and are eager to understand the general programming of computers, R language is not an ideal choice. You can choose python, C or Java.

Both R language and C language are the research achievements of Bell Laboratories, but they have different emphasis areas. R language is an explanatory language for mathematical theory researchers, while C language is designed for computer software engineers.

R language is a language for interpretation and operation (different from the compilation and operation of C language). Its execution speed is much slower than that of C language, which is not conducive to optimization. However, it provides more abundant data structure operation at the syntax level and can easily output text and graphic information, so it is widely used in mathematics, especially in statistics

### Read More:

- [Solved] Error in Summary.factor ‘max’ not meaningful for factors
- [Solved] Kafka Error: InvalidReplicationFactorException: Replication factor:
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- When Wireshark grabs packets, IP check sum error is displayed
- The method println(boolean) in the type PrintStream is not applicable for the arguments (void) Error
- [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
- Error: could not find function … in R [How to Solve]
- C++ new types may not be defined in a return type Error?
- [Solved] hive Caused by: MetaException(message:Version information not found in metastore. )
- [Solved] error: ‘xcb_generic_event_t’ was not declared in this scope
- How to Solve Error:‘itoa’ was not declared in this scope
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- [Solved] Flink Hadoop is not in the classpath/dependencies
- [Solved] error: ‘CV_GRAY2BGR’ was not declared in this scope
- [Solved] AS Warning: String literal in setText can not be translated. Use Android resources instead.
- [Solved] MindSpore Error: ReduceMean in the Ascend environment does not support inputs of 8 or more dimensions
- Bin File Programming Failed, could not find core in coresight setup, erase error