[R] remove quotes from matrix
greg holly
mak.hholly at gmail.com
Tue Sep 19 16:49:12 CEST 2017
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]]
More information about the R-help
mailing list