Data-driven computing in applied mechanics utilizes the material data set directly, and hence is free from errors and uncertainties stemming from the conventional material modeling. This paper presents a simple heuristic for data-driven computing, that is robust against noise and outliers in a data set. For each structural element, we extract the material property from some nearest data points. Using the nearest neighbors reduces the influence of noise, compared with the existing method that uses a single data point. Also, the robust regression is adopted to reduce the influence of outliers. Numerical experiments on the static equilibrium analysis of trusses are performed to illustrate that the proposed method is robust against the presence of noise and outliers and, hence, is effective for dealing with real-world data.