<<xAct`xTensor`;
Needs["xAct`xPert`"];
<<xAct`xCoba`;
<<xAct`xTras`;
$DefInfoQ=False;
$CVVerbose=False;

(*Define manifold, metric, and FRW chart*)

SetOptions[ToCanonical,UseMetricOnVBundle->None] ;
DefManifold[M4,4,{α,β,γ,λ,μ,ν,ξ,ζ,ψ,κ}];
DefMetric[-1,g[-μ,-ν],CD,CurvatureRelations->True];
DefChart[B,M4,{0,1,2,3},{t[],x[],y[],z[]}];
DefScalarFunction[a];
MatrixForm[FRW={{1,0,0,0},{0,-a[t[]]^2,0,0},{0,0,-a[t[]]^2,0},{0,0,0,-a[t[]]^2}}]
MetricInBasis[g,-B,FRW]//TableForm 
MetricCompute[g,B,All];

(*Of course, no problem computing any regular covariant curvature tensors in this basis:*)

Last@TensorValues[RicciCD]//Column

(*Suppose I want the contravariant elements in this basis*)

RicciUp=ContractMetric[g[μ,α]g[ν,β]RicciCD[-α,-β]]

Last@TensorValues[RicciUp]//Column

(*Showing the covariant elements again. Defining it as a tensor, similar to below, doesn't work either*)

(*As mentioned, I would also like to define a tensor in terms of the curvature tensors and print/show its elements in this chart, for example*)

DefTensor[X[-μ,-ν],M4]

IndexSet[X[-μ,-ν],ContractMetric[RicciCD[-μ,-α]RicciCD[α,-ν]]]

Last@TensorValues[X]//Column

DefTensor[Y[-μ,-ν],M4]

IndexSet[Y[-μ,-ν],ContractMetric[g[α,β]RicciCD[-μ,-α]RicciCD[-β,-ν]]]

Last@TensorValues[Y]//Column

(*Something else is clearly needed!*)

We must use ChangeComponents

TensorValues[RicciCD]

ChangeComponents[RicciCD[{μ,B},-{ν,B}],RicciCD[-{μ,B},-{ν,B}]];
ChangeComponents[RicciCD[{μ,B},{ν,B}],RicciCD[-{μ,B},-{ν,B}]];

TableForm[Table[RicciCD[{μ,-B},{ν,-B}],{μ,0,3},{ν,0,3}]//ToValues//ToValues]

TableForm[Table[RicciCD[{μ,B},{ν,-B}],{μ,0,3},{ν,0,3}]//ToValues//ToValues]

TableForm[Table[RicciCD[{μ,B},{ν,B}],{μ,0,3},{ν,0,3}]//ToValues//ToValues]

TensorValues[RicciCD]

If you want the components of Y

TableForm[Y[-μ,-ν]//ToBasis[B]//ComponentArray//TraceBasisDummy//ToValues//ToValues]