Edoardo Prestianni
2014-Nov-24 18:23 UTC
[R] How to print labels and how to add missing label values?
Hello everyone, Sorry for the "rookie" question but this is really beyond me at the moment. Here is my problem I have three datasets I am trying to work on. They're three panels. They have this variable, 'kecnum', which is present in all the three datasets, and it looks like it has been labeled in only one of the three datasets. When I import the datasets, R gives me a WARNING, stating [code] value labels (?kecnum?) for ?kecnum? are missing [/code] for two datasets out of three. Looking at the tables, you see that the variable grows normally... (like 1, 1, 2, 2, 3, 3, 4, 4, 5, 5...) in the datasets for which the warning is given. For the dataset for which the warning is NOT given, I just have a list of "NA" If I use the "describe" command, R prints out just [code] kecnum : Variable label for variable kecnum [/code] for all the THREE datasets. Only using Rstudio I can "see" a difference in the labeling of the variable between the datasets for which I am "warned" and the one for which I am not (screenshots attatched) But I have no idea on how to print that stuff out on a terminal. And most of all, on how to fix my datasets. Thank you very much for your time. -------------- next part -------------- A non-text attachment was scrubbed... Name: here it is missing.png Type: image/png Size: 9446 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20141124/2983537b/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: here it is not.png Type: image/png Size: 8577 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20141124/2983537b/attachment-0001.png>
Edoardo Prestianni
2014-Nov-24 18:32 UTC
[R] How to print labels and how to add missing label values?
P.S. huge typo in the e-mail object: I guess I want to print and edit "value labels", not "label values" 2014-11-24 19:23 GMT+01:00 Edoardo Prestianni <edoardo.prestianni at gmail.com> :> Hello everyone, > > Sorry for the "rookie" question but this is really beyond me at the moment. > > Here is my problem > > I have three datasets I am trying to work on. They're three panels. > > They have this variable, 'kecnum', which is present in all the three > datasets, and it looks like it has been labeled in only one of the three > datasets. > > When I import the datasets, R gives me a WARNING, stating > > [code] value labels (?kecnum?) for ?kecnum? are missing [/code] > > for two datasets out of three. > > > Looking at the tables, you see that the variable grows normally... (like > 1, 1, 2, 2, 3, 3, 4, 4, 5, 5...) in the datasets for which the warning is > given. > For the dataset for which the warning is NOT given, I just have a list of > "NA" > > > If I use the "describe" command, R prints out just > [code] kecnum : Variable label for variable kecnum [/code] > > for all the THREE datasets. > > > Only using Rstudio I can "see" a difference in the labeling of the > variable between the datasets for which I am "warned" and the one for which > I am not > (screenshots attatched) > > > But I have no idea on how to print that stuff out on a terminal. And most > of all, on how to fix my datasets. > > > Thank you very much for your time. >-- Edoardo Prestianni [[alternative HTML version deleted]]
David Winsemius
2014-Nov-24 20:14 UTC
[R] How to print labels and how to add missing label values?
On Nov 24, 2014, at 10:23 AM, Edoardo Prestianni wrote:> Hello everyone, > > Sorry for the "rookie" question but this is really beyond me at the moment. > > Here is my problem > > I have three datasets I am trying to work on. They're three panels. > > They have this variable, 'kecnum', which is present in all the three > datasets, and it looks like it has been labeled in only one of the three > datasets. > > When I import the datasets, R gives me a WARNING, stating > > [code] value labels (?kecnum?) for ?kecnum? are missing [/code]You did not offer the input statements that you used. The warning suggest to me that you are using a function for reading SPSS or SAS data files.. The "here it is not.png" image shows a factor variable, suggesting there was a non-numeric value detected in the automatic guessing process used by the read.* functions, and that a character/integer representation was automatically chosen for only one. The otehr two were all unquoted integers and so came in as integers.> > for two datasets out of three. > > > Looking at the tables, you see that the variable grows normally... (like > 1, 1, 2, 2, 3, 3, 4, 4, 5, 5...) in the datasets for which the warning is > given. > For the dataset for which the warning is NOT given, I just have a list of > "NA"Was there a value in that position in the first line of data?> > > If I use the "describe" command, R prints out just > [code] kecnum : Variable label for variable kecnum [/code] > for all the THREE datasets. >There must be 5 or six packages with a 'describe' function, and it's clear you are not using the one I typically use.> > Only using Rstudio I can "see" a difference in the labeling of the variable > between the datasets for which I am "warned" and the one for which I am not > (screenshots attatched) > > > But I have no idea on how to print that stuff out on a terminal. And most > of all, on how to fix my datasets.Most people would use the 'str' function. And if we are to advise on how to fix a dataset, then we would need to know what you consider correct, which you have not yet stated.> > > Thank you very much for your time. > <here it is missing.png><here it is not.png>______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius Alameda, CA, USA