[R] need help

Rui Barradas ruipbarradas at sapo.pt
Sat Sep 20 14:53:20 CEST 2014


Hello,

Your data.frame only has 2 columns, x and y. The rest are attributes of 
the column y. To access those attributes you can use something like

attr(fxmale, "covariates")  # This is the one you want
attr(fxmale, "meanSD")
attr(fxmale, "boundingbox")

and save them in other csv files (most probably not with the same 
write.csv command).

Or maybe

df2 <- cbind(fxmale, attr(fxmale, "covariates"))

and then save df2

Hope this helps,

Rui Barradas

Em 20-09-2014 07:52, Ujjwal Kumar escreveu:
> I have the datafram like "fxmale"
>
> head(fxmale)
>         x       y         D.fx         D.nc        D.sum1 445350
> 2463450 1.046935e-06 0.0002627856 0.00026383262 445350 2463950
> 1.314861e-06 0.0002618268 0.00026314163 445350 2464450 1.435987e-06
> 0.0002627193 0.00026415534 445350 2464950 1.362894e-06 0.0002652938
> 0.00026665675 445350 2465450 1.122175e-06 0.0002690738 0.00027019606
> 445350 2465950 7.998899e-07 0.0002734074 0.0002742073
>
> when I am trying to export as csv I am getting only the first two columns
> (x & y) not others columns. This is the structure of the data.
>
>> str(fxmale)
> Classes ‘Dsurface’, ‘mask’ and 'data.frame':    5735 obs. of  2 variables:
>   $ x: int  445350 445350 445350 445350 445350 445350 445350 445350
> 445350 445350 ...
>   $ y: int  2463450 2463950 2464450 2464950 2465450 2465950 2470950
> 2471450 2471950 2472450 ...
>   - attr(*, "covariates")='data.frame':  5735 obs. of  3 variables:
>    ..$ D.fx : num  1.05e-06 1.31e-06 1.44e-06 1.36e-06 1.12e-06 ...
>    ..$ D.nc : num  0.000263 0.000262 0.000263 0.000265 0.000269 ...
>    ..$ D.sum: num  0.000264 0.000263 0.000264 0.000267 0.00027 ...
>   - attr(*, "type")= chr "user"
>   - attr(*, "meanSD")='data.frame':      2 obs. of  2 variables:
>    ..$ x: num  475535 17942
>    ..$ y: num  2458930 10937
>   - attr(*, "area")= num 25
>   - attr(*, "spacing")= num 500
>   - attr(*, "boundingbox")='data.frame': 4 obs. of  2 variables:
>    ..$ x: num  445100 507600 507600 445100
>    ..$ y: num  2434700 2434700 2483700 2483700
>    ..- attr(*, "out.attrs")=List of 2
>    .. ..$ dim     : Named int  2 2
>    .. .. ..- attr(*, "names")= chr  "x" "y"
>    .. ..$ dimnames:List of 2
>    .. .. ..$ x: chr  "x=445100" "x=507600"
>    .. .. ..$ y: chr  "y=2434700" "y=2483700"
>
> can any body help me???
>



More information about the R-help mailing list