[R] How to view the whole dataset that is imported through sasxport.get
Jun Shen
jun.shen.ut at gmail.com
Thu Aug 21 19:59:40 CEST 2014
David,
Thanks for your reply.
Here is some of the output of str()
'data.frame': 1991 obs. of 5 variables:
$ SID :Class 'labelled' atomic [1:1991] 01018 01018 01018 01018 ...
.. ..- attr(*, "label")= chr "Subject ID"
$ DV :Class 'labelled' atomic [1:1991] NA 8.52 463 364 240 278 237
167 83.7 260 ...
.. ..- attr(*, "label")= chr "Numeric Result in Standard Unit"
$ VISI:Class 'labelled' atomic [1:1991] 1 1 1 1 1 1 1 1 1 7 ...
.. ..- attr(*, "label")= chr "Planned Study Day of Visit"
$ NRT :Class 'labelled' atomic [1:1991] 0 0.75 1.5 3 4 6 9 12 24 0 ...
.. ..- attr(*, "label")= chr "Nominal Relative Time"
$ TIME:Class 'labelled' atomic [1:1991] -1.1 0.8 1.5 3 4 ...
.. ..- attr(*, "label")= chr "Actual Relative Time"
On Thu, Aug 21, 2014 at 11:53 AM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> On Aug 21, 2014, at 7:20 AM, Jun Shen wrote:
>
> > Dear list,
> >
> > I used sasxport.get to import a SAS xpt file. Although it is a data frame
> > but i can't view it through the "fix" command. Also when I see its
> > structure, it brings up attributes I am not really interested in (which
> > seems part of the SAS labels) and it doesn't seem to tell me the mode of
> > each column. How do I suppress those attributes and view it through
> "fix"?
> > Thanks.
>
> It would have helped a lot if you had offered outout of: str(dataset)
>
> I don't use fix() so I'm not sure I help you there. I do notice in looking
> at the documentation that the function may return a list of dataframes
> rather than just a dataframe, so perhaps you need to extract the dataframe
> object. (Just a guess.)
>
> I generally look at my files with names(), and Hmisc::describe() and use
> table() for the factor or character values that I expect to have manageable
> numbers of discrete categories. (Using `fix()` to edit gigabyte sized
> objects is the way to madness.) You should probably read the Posting Guide
> because you are failing to mention that the sasxport.get() function is part
> of the Hmisc package. If you want to get rid of your attributes (which is
> where the labels are stored) then the attr() function should allow you to
> NULL them out:
>
> > x <- 1:10
> > attr(x,"dim") <- c(2, 5)
> >
> > x
> [,1] [,2] [,3] [,4] [,5]
> [1,] 1 3 5 7 9
> [2,] 2 4 6 8 10
> > attr(x,"dim")
> [1] 2 5
> > attr(x,"dim") <- NULL
> > x
> [1] 1 2 3 4 5 6 7 8 9 10
>
> It also appears the there is a `label<-` function, so you could probably
> use that to NULL them out.
>
> --
>
> David Winsemius
> Alameda, CA, USA
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list