Q: Should independent variables measured only once per set of replcations be duplicated in the data? I have a dataset from an experiment on soil erosion, where

*

*soil samples a, b and c where collected, and

*measurement of an independent soil property x was taken for each soil sample,

such as in the following small example:
  type   x
1    a 1.7
2    b 1.9
3    c 1.9

Next, four sub-samples from the each soil sample were subject to an experiment on soil erosion, where soil erosion metric y was measured. Technically, the "bucket" with each soil sample was divided to four sub-samples 1, 2, 3 and 4, then y was measured in each sub-sample:
   type repl   y
1     a    1 1.3
2     a    2 1.6
3     a    3 1.4
4     a    4 1.2
5     b    1 2.3
6     b    2 2.2
7     b    3 2.1
8     b    4 2.0
9     c    1 1.7
10    c    2 2.1
11    c    3 1.5
12    c    4 1.2


My question is: when analyzing the effects of x on y, such as using lm in R, which approach is more correct, (A) or (B)?
(A) Analyzing all 12 observations, while duplicating the measurement of x for each set of four sub-samples:
   type repl   x   y
1     a    1 1.7 1.3
2     a    2 1.7 1.6
3     a    3 1.7 1.4
4     a    4 1.7 1.2
5     b    1 1.9 2.3
6     b    2 1.9 2.2
7     b    3 1.9 2.1
8     b    4 1.9 2.0
9     c    1 1.9 1.7
10    c    2 1.9 2.1
11    c    3 1.9 1.5
12    c    4 1.9 1.2

(B) Analyzing the three observations, where outcome y is averaged:
  type   x     y
1    a 1.7 1.375
2    b 1.9 2.150
3    c 1.9 1.625

P.S. If the answer is (A), is it necessary to treat type as a random effect?
Thank you very much for any help or guidance.

A: If you had more data points and more type categories, then a multilevel/mixed effects model estimated on data A would be the way to go. You could do this with your 12 data points, but this is an exceedingly small amount of data to estimate a multilevel or mixed effects model with. You can do so, but you will want to use a small sample size correction, specifically the Kenward-Roger degrees of freedom:
require(lmertest)
library(lme4)
m1.lmer <- lmer(y ~ x + (1|type), data=dat.A)
summary(m1.lmer, ddf="Kenward-Roger") 

Even if you had more data points in each type, you only have 3 types. That is a very small number of groups for a multilevel/mixed effects modeling approach. Thus, unless you were prepared to use a Bayesian approach (completely reasonable if you know what you are doing), some people might say that a better frequentist option to use with the long data, what I called dat.A, is to estimate an OLS (lm) with a fixed effect of type:
m.lm1 <- lm(y ~ x + type, data=dat.A)

In this model, type is a 3 category dummy variable. The coefficient on type is an adjusted mean y value for the plot relative to the hold-out category. It is adjusted based on the plot's x values. The intercept in this case is the adjusted mean value of y or the hold-out category.
You could leave out the intercept and get the adjusted mean for each group directly by running the lm model as follows:
m.lm2 <- lm(y ~ x + type + 0, data=dat.A) // +0 removes the intercept

