[R] importing data
jrkrideau at yahoo.ca
Sat May 5 04:25:11 CEST 2007
--- croero at hotmail.com wrote:
> I need to import a data set.
> I have never imported data files with R. I have
> always worked on simulated data.
> I have looked at R Data Import/Export manual.
> It is a bit peculiar because my data base is already
> an R object called "japan".
Then you do not want to import it.If you already have
an R.object then you'e done. It is already 'imported.
You just need to work with it, probaly as a data.frame
> I guess it is not yet a data set, and I don't know
> how to manipulate variables from it.
> When I type "japan", here is an extract of what I
> LDP NFP SKG JCP gender education age1 80 75
> 80 0 male 1 752 75 80 50 20
> female 1 643 100 25 100 0 male
> 2 564 75 50 25 50 male 2 525
> 75 50 50 0 male 4 52
> I have saved the following objet in a file called
> "japan.RData". Then I have tried the following
> instructions :
> read.table(file="japan.RData",header = FALSE, sep =
> I get the following result :
> " V11 \037ï¿½\bWarning message:readTableHeader
> trouvï¿½ une ligne finale incomplï¿½te dans
> 'japan.RData' "
> which means probably "has found the last lign
> incomplete", I am not too sure...
I don't know that the error messages mean but it is
likely that they mean "you already did it , go away"
> What can I do ? I want to get variables such LDP,
> NFP, SKG, JCP, gender, education, and age. How can I
> do that ?
> Thank you very much.
Do an ls() and find out what objects you have. If you
have a Japan then you can do Japan$LPD or Japan[,1] or
an attach(Japan) and then refer to LPD. Each approach
has its advantages.
See http://www.r-project.org/ for some basic
information on the subject.
More information about the R-help