[R] A simple string alienation problem

Soumyadip Bhattacharyya @@b@@@m2801 @end|ng |rom gm@||@com
Tue Apr 14 12:55:17 CEST 2020


***Dear Eric,*****
sending from gmail following the way you suggested. Hope now everyone
can see this email. **** I have also attached the first 50 rows of the
FIght.csv.***
***Output - I will try to do Market basket analysis on this to find
out rules that I am learning. so once I have the data in transactional
format - then I can run the algorithm and keep learning. This little
problem has caused a barrier in my path - I can alienate the string in
excel - but wanted to do in R - so researching I tried doing this:
x<- substr(x, 1, nchar(x) - 1)  // but I wasn't successful and I tried
many other things - its not coming in the transactional format. ***
Hence now reached out to the experts.**** Many Thanks.

Hello Dear R Community,

I would ask a little bit of help from you please:I have a dataset,
which is in a CSV file – I have read it into R as follows:

      V1
tropical fruit"
whole milk"
pip fruit"
other vegetables"
whole milk"
rolls/buns"

The issue is: the data set in csv file also appears with the quotation
marks “. I can’t get rid of the quotation marks. I want to do it in R.
The Quotes only appear at the end of the string. The dataset has many
rows – this is just a copy. My intention is to be able to get rid of
the quotes and then want to separate the strings with a ‘/’. i.e.
rolls/buns should be rolls in one column and buns in another.

I know this is something very simple I am lacking – but if you could
please show me how to do this? If someone could throw some light
please. I read the data in with a simple read.csv statement:

> x <- read.csv("Fight.csv", stringsAsFactors = F, header = F)
> str(x)
Output:
> str(calc)
'data.frame':   38765 obs. of  1 variable:
$ V1: chr  "tropical fruit\"" "whole milk\"" "pip fruit\"" "other
vegetables\"" ...

Many Thanks in advance for your help.
Kind Regards,
Sam.


More information about the R-help mailing list