Dear Agrima

As well as Sarah's seven possibilities an eighth occurs to me: you have not yet read it into R in the first place. If that is the case you may be able to use read.table to get it into a data frame with columns corresponding to your words.
?read.table may be your friend here.

On 28/08/2015 15:42, Sarah Goslee wrote:
Hi,

On Fri, Aug 28, 2015 at 7:49 AM, agrima seth <sethagr...@gmail.com> wrote:
i have a text file with data of the given format:

white snow
lived snow
in snow
lived place
in place
a place
called place
as place

That doesn't specify the format. I can think of at least seven things
that could be:
a character vector
a two-column matrix
a one-column matrix
a two-column data frame, with or without values correctly specified as character
a one-column data frame, with or without values correctly specified as character

The correct answer depends on what the format actually is; you need to
use dput() or some other unambiguous way of providing sample data.

Here are some suggestions for creating a good reproducible example:
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Some combination of strsplit() and table(), possibly with apply(),
will be the answer, though.

Sarah

here i have to find the frequency of the terms only in the first column
(i.e.)
white - 1
lived- 2
in -2
a-1
called - 1
as -1

Could you please guide me how to do the above in R.

         [[alternative HTML version deleted]]
and please don't post in HTML, as it makes figuring out what you meant
even more difficult.

Sarah



--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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