Re: [R] Retaining attributes of columns of a data frame when subsetting.

2019-10-19 Thread Rolf Turner
On 20/10/19 3:00 PM, Richard M. Heiberger wrote: Look at methods(as.data.frame) Define your specialized columns to have a newly defined class, say "myclass". Then write as.data.frame.myclass It will be similar to the function you already have in the lapply statement. Now your statement X <-

Re: [R] Retaining attributes of columns of a data frame when subsetting.

2019-10-19 Thread Richard M. Heiberger
Look at methods(as.data.frame) Define your specialized columns to have a newly defined class, say "myclass". Then write as.data.frame.myclass It will be similar to the function you already have in the lapply statement. Now your statement X <- X[ok,] should work. Rich On Sat, Oct 19, 2019 at 8:20

[R] Retaining attributes of columns of a data frame when subsetting.

2019-10-19 Thread Rolf Turner
I am writing a function that involves a data frame "X" some columns of which have attributes. I replace X by a data frame with a subset of the rows of X: X <- X[ok,] where "ok" is a logical vector. When I do this the attributes of the columns (which I need to retain) are lost

Re: [R] Preserving numeric columns

2019-10-19 Thread Felipe Carrillo via R-help
Yes, options(knitr.kable.NA = '-')  is The answer for kable. Do you happen to know what are the arguments used for gridExtra grid.draw to acomplish the same thing? Sent from Yahoo Mail on Android On Sat, Oct 19, 2019 at 1:01 PM, Jeff Newmiller wrote: Then the polite next step is for you

Re: [R] L1 (lasso) regularized log-linear model selection procedure

2019-10-19 Thread Bert Gunter
Searching on "lasso penalty with deviance" on rseek.org brought up many packages. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Oct 19, 2019

Re: [R] Preserving numeric columns

2019-10-19 Thread Jeff Newmiller
Then the polite next step is for you to indicate what that solution was so people searching the archives can learn from your question. Was it to set the kable option? options(knitr.kable.NA = '-')  On October 19, 2019 12:50:20 PM PDT, Felipe Carrillo wrote: >You are correct. I didnt explain

Re: [R] Preserving numeric columns

2019-10-19 Thread Felipe Carrillo via R-help
You are correct. I didnt explain well and failed to mention that this is for knitr::kable. I already figured it out.  Sent from Yahoo Mail on Android On Sat, Oct 19, 2019 at 1:04 AM, Jeff Newmiller wrote: Data frames are NOT spreadsheets. Don't treat them like spreadsheets. All elements

Re: [R] "chi-square" | "chi-squared" | "chi squared" | "chi, square"

2019-10-19 Thread William Dunlap via R-help
Sigma squared or sigma square? Hotelling's T-squared or T-square? Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Oct 19, 2019 at 7:38 AM Therneau, Terry M., Ph.D. via R-help < r-help@r-project.org> wrote: > Martin, >A fun question. > > Looking back at my oldest books, Feller (1950)

[R] L1 (lasso) regularized log-linear model selection procedure

2019-10-19 Thread Davor Josipovic
Daphne Koller (2009) describes L1 regularization (Chapter 20) as an efficient way for Markov network (i.e. undirected graphical model) structure learning and feature parameter estimation. Her focus, and mine, are log-linear models for high-dimensional contingency tables (i.e. categorical data).

Re: [R] "chi-square" | "chi-squared" | "chi squared" | "chi, square"

2019-10-19 Thread Therneau, Terry M., Ph.D. via R-help
Martin,   A fun question. Looking back at my oldest books, Feller (1950) used chi-square. Then I walked down the hall to our little statistics library and looked at Johnson and Kotz, "Continous Univariate Distributions", since each chapter therein has comments about the history of the

Re: [R] Calculating returns of bid using R

2019-10-19 Thread Benoit Vaillant
Hello, See inline. On Sat, Oct 19, 2019 at 01:48:44PM +0530, Sri Priya wrote: > Dear R Users, > Question: > > A chit fund has 25 members. Each month they contribute Rs 2000 each. End of > the month, the person who bids the lowest for the corpus, gets his bid. The > group organizer gets paid a

Re: [R] List of data frame

2019-10-19 Thread Rui Barradas
Hello, Why not use read.xlsx argument 'na.strings', an argument that exists in many file reading functions? (read.table, and derivatives.) test <- lapply(sheets,function(i) { read.xlsx("rainfall.xlsx", sheet = i, startRow = 8, cols = 1:2, na.strings = "") })

[R] Calculating returns of bid using R

2019-10-19 Thread Sri Priya
Dear R Users, I am practicing problems in the field of finance and economics. While searching, I got problem like this. And I want to solve the following problem using R. I dont have any clue how to incorporate this in R. Please help me!! Question: A chit fund has 25 members. Each month they

Re: [R] Preserving numeric columns

2019-10-19 Thread Jeff Newmiller
Data frames are NOT spreadsheets. Don't treat them like spreadsheets. All elements in a column are parts of a vector which means they all have the same data type. On the other hand, if you want to generate formatted output in HTML, LaTeX, or Word, there are many tools for generating formatted

[R] Preserving numeric columns

2019-10-19 Thread Felipe Carrillo via R-help
Consider the following dataset:  I need to replace NAs with "-" but I lose my numeric formatting  fall.estimate <- structure(list(`Salmon` = c("salmon River", "Ant Creek", "big Creek", "oso River", "linda Creek"), `baseline` = c(80874.384012, 361.1997, 5012.8311, 638.6912, 402.1044),