CAN you use as.matrix(dat) to convert your data frame to a matrix?
Yes, certainly. Try it!
SHOULD you do this?
Well, why do you WANT a matrix? Data frames act a lot like
two-dimensional arrays as they are.
If "the values are basically categories", then perhaps they should BE
factors and process
Yes you can. Whether that will yield useful or misleading results depends what
analytical tools you intend to apply to the resulting matrix. Categorical data
in matrices tends to be kind of a dead end in my experience... but ymmv.
On June 25, 2025 5:23:47 PM PDT, Daniel Lobo wrote:
>My data fra
Thanks for confirmation.
My only fear was that if I use as.matrix(na.omit(dat)) to a dataframe
like the one I shared, if I would face any data lose or change or not.
On Thu, 26 Jun 2025 at 07:53, Jeff Newmiller wrote:
>
> Yes you can. Whether that will yield useful or misleading results depends
ething about your real question? Matrices are not
always a great choice and data.frames can do many of the same things for a
2-D object especially if you use some packages that ...
-Original Message-
From: R-help On Behalf Of Daniel Lobo
Sent: Wednesday, June 25, 2025 8:24 PM
To: Rolf Turner
y and Paliative Care,
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382
From: R-help on behalf of Daniel Lobo
Sent: Wednesday, June 25, 2025 8:23 PM
To: Rolf Turner
Cc: r-help@r-project.org
Subject: Re: [R] Conve
My data frame looks like below
dat = structure(list(a = c(66, 100, 100, 100, 100, 100, 100, 66, 100,
66), b = c(100, 50, 100, 100, 100, 100, 100, 100, 100, 100),
c = c(75, 25, 75, 50, 50, 50, 50, 50, 75, 25)), class =
"data.frame", row.names = c(NA,
-10L))
The values are basically categori
To add to Rolf's comments:
1. What you do with your data may depend on what you want to do with it
*after* you have fiddled with its structure. Treating numerical categories
as numerics is often a bad idea for many kinds of analyses or even graphics;
2. Note that na.omit(d) when d is a data frame
On Thu, 26 Jun 2025 03:45:50 +0530
Daniel Lobo wrote:
> Hi,
>
> I have a dataframe for which all columns are numeric but categorical.
I don't understand what that means. Perhaps an example?
> There are some missing values as well
>
> Typically, I have CSV file saved in drive, and then read
On Fri, Oct 16, 2009 at 01:55:03AM -0700, Noah Silverman wrote:
> I think you may be correct.
>
> I've manage to get the data into a format that the function accepts.
>
> The error appears to be because I have negative values in my data:
>
> Error in apply(safeNormCDF(s), 1, prod) :
> dim(X)
I think you may be correct.
I've manage to get the data into a format that the function accepts.
The error appears to be because I have negative values in my data:
Error in apply(safeNormCDF(s), 1, prod) :
dim(X) must have a positive length
On 10/16/09 1:51 AM, Philipp Pagel wrote:
On F
On Fri, Oct 16, 2009 at 01:33:14AM -0700, Noah Silverman wrote:
> Hi,
>
> I'm experimenting with a few learners that require a matrix as their
> input. (Currently svmpath, vbmp, etc.)
>
> I currently have a dataframe with 50 columns and 20,000 rows.
>
> I tried using:
>
> x <- as.matrix(my_dat
11 matches
Mail list logo