Can you send us a small subset of your data frame? Thanks.
-- Mike
On Fri, Jan 13, 2017 at 10:06 PM, Gouri Shankar Mishra
<gouri....@gmail.com> wrote:
> Hello, I have a data frame with a large number of columns. All columns are
> coded as factor vars. Some of the columns end with "Sum" and I want to
> convert these columns to numeric variables.
>
>
> The following code gives me an error:
>
> df <- df %>% mutate_if(ends_with("Sum"), as.numeric(.))
> Error in get(as.character(FUN), mode = "function", envir = envir) :
> object 'p' of mode 'function' was not found
>
> Thanks for your time.
>
> --
> Check out our R resources at http://d-rug.github.io/
> ---
> You received this message because you are subscribed to the Google Groups
> "Davis R Users' Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to davis-rug+unsubscribe@googlegroups.com.
> Visit this group at https://groups.google.com/group/davis-rug.
> For more options, visit https://groups.google.com/d/optout.
--
Check out our R resources at http://d-rug.github.io/
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+unsubscribe@googlegroups.com.
> email to davis-rug+...@googlegroups.com.
> Visit this group at https://groups.google.com/group/davis-rug.
> For more options, visit https://groups.google.com/d/optout.
--
Check out our R resources at http://d-rug.github.io/
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
# Create index of columns with "cyl" or "hp" in colnames
i = grep("cyl|hp", colnames(mtcars))
# Use that index to subset the dataframe, and apply() to convert those columns
# (I convert to character since the columns start as numeric, but the idea is the same
mtcars[,i] = apply(mtcars[,i], 2, as.character)