On Apr 27, 2010, at 4:23 PM, Alex Jameson wrote:

David,

merg12

displays the files
with this message at the bottom

[reached getOption("max.print") -- omitted 321526 rows]]

str(merg12) displays the following message

'data.frame' : 329218 obs. of 13 variables

$ patientid:
$ Name:
$ Age:

but no file is created in the folder mydata

i would expect a file to be created, which is not happening

R is not SPSS. R does its work in memory and has particular functions to export or save data (which are two different processes). All this would be explained in any introductory text for R. I think you need to go back to the "Introduction to R" and the other introductory texts to get a better handle on the basics. I had checked it to see if merge were describe there and it was not, so I assumed you might have read it, but it seems not. You seem to have missed quite a few of its important lessons.

Perhaps unlike the SPSS equivalent (however it might be organized by IBM at the moment) the R-help mailing list is _not_ set up to be a tutoring facility. You are asked to study on your own the large amount of free introductory material, work through the examples ... on your own, ... and then and only then, compose detailed questions with full code and complete example datasets. I did previously suggest that you read the Posting Guide. I now also repeat that suggestion. You might also read through the R-FAQ as well.

--
David.



Thank you

Alex


On Tue, Apr 27, 2010 at 4:41 PM, David Winsemius <dwinsem...@comcast.net >wrote:


On Apr 27, 2010, at 4:23 PM, Alex Jameson wrote:

Hi David,

I have executed

data1 <- read.table("c:\\mydata\\file1.txt")
data2 <- read.table("c:\\mydata\\file2.txt")

merg12 <- merge(data1, data2)

but am not sure, if it has merged them,
ideally, i would want a new file name for the merged data, based on the
identical IDs,


That is what you should have gotten. what happens when you type

merg12

??

and i would need to eliminate some column names (fields) which are not
required


That can be don easily. Show us:

str(merg12)


-- David.



Alex



On Tue, Apr 27, 2010 at 2:51 PM, David Winsemius <dwinsem...@comcast.net
wrote:


On Apr 27, 2010, at 1:19 PM, Alex Jameson wrote:

This is a more detailed description of the problem,


I have written the following lines of code to read the files

data1=("c:\\mydata\\file1.txt")
data2=("c:\\mydata\\file2.txt")


NONONO. Read the manual again. Perhaps:

data1 <- read.table("c:\\mydata\\file1.txt")
data2 <- read.table("c:\\mydata\\file2.txt")


file 1 has fields like patientID, Name which are common in file2, however
not all fields are common

i would like to create file3.txt with the merged data fields,


And what might happen happened when you tried:

merg12 <- merge(data1, data2)

??? ... by default it would merge on the field names (actually column
names in R-parlance) that were shared by the two dataframes.

--
David


i hope this is clear, and i thank everyone, who has responded so far.


Alex Jameson
Student,
University of Colorado

    [[alternative HTML version deleted]]

______________________________________________
R-help@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<http://www.r-project.org/posting-guide.html >
<http://www.r-project.org/posting-guide.html>

and provide commented, minimal, self-contained, reproducible code.




      [[alternative HTML version deleted]]

______________________________________________
R-help@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<http://www.r-project.org/posting-guide.html >
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT



        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to