[R] remove quotes from matrix

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Sep 19 17:11:10 CEST 2017


Greg, I think you should stop using noquote, because it is doing something that will not be useful to you for preparing your data for analysis.

Please follow Duncan's advice and provide us with a sample of your data.  Also, please set your email program to send plain text rather than HTML formatted text. 
-- 
Sent from my phone. Please excuse my brevity.

On September 19, 2017 7:49:12 AM PDT, greg holly <mak.hholly at gmail.com> wrote:
>Hi Duncan and Bert;
>
>I do appreciate for your replies. I just figured out that after x1=
>noquotes(x) commend my 733*22 matrix returns into n*1 vector. Is there
>way
>to keep this as matrix with the dimension of 733*22?
>
>Regards,
>
>Greg
>
>
>On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch
><murdoch.duncan at gmail.com>
>wrote:
>
>> On 19/09/2017 9:47 AM, greg holly wrote:
>>
>>> Hi all;
>>>
>>> I have data at 734*22 dimensions with rows and columns names are
>>> non-numeric.When I convert this data into matrix then all values
>show up
>>> with quotes. Then when I use
>>> x1= noquotes(x) to remove the quotes from the matrix then
>non-numeric row
>>> names remain all other values in matrix disappear.
>>>
>>> Your help is greatly appreciated.
>>>
>>>
>>
>> Matrices in R can have only one type.  If you start with a dataframe
>and
>> any columns contain character data, all entries will be converted to
>> character, and the matrix will be displayed with quotes.
>>
>> When you say all values disappear, it sounds as though you are
>displaying
>> strings containing nothing (or just blanks).  Those will be displayed
>as ""
>> normally, but if the matrix is marked to display without quotes, they
>are
>> displayed as empty strings, so it will appear that nothing is
>displayed.
>>
>> You can see the structure of the original data using the str()
>function,
>> e.g. str(x) should display types for each column.
>>
>> If this isn't enough to explain what's going on, please show us more
>> detail.  For example, show us the result of
>>
>> y <- x[1:5, 1:5]
>> dput(y)
>>
>> both before and after converting x to a matrix.
>>
>> Duncan Murdoch
>>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.



More information about the R-help mailing list