[R] A simple lattice histogram

2022-04-20 Thread Naresh Gurbuxani
I am struggling with a simple histogram where scales of x-axis should be free.   Each panel should only show the range relevant for data plotted in that panel.   library(lattice) library(AER) data(CreditCard) histogram( ~ card + reports, data = CreditCard, scales = "free") This code creates two p

Re: [R] [External] A simple lattice histogram

2022-04-20 Thread Richard M. Heiberger
start here library(latticeExtra) c(histogram(~ card, data=CreditCard), histogram(~ reports, data=CreditCard)) then continue with resizePanels(c(histogram(~ card, data=CreditCard), histogram(~ reports, data=CreditCard), y.same=TRUE), w=c(2,16)) > On Apr 20, 2022, at 11:27, Naresh Gurbuxani

Re: [R] [External] A simple lattice histogram

2022-04-20 Thread Naresh Gurbuxani
Richard, Thanks for your quick response.  Since I also want the name of the variable in the histogram, I settled for below code.  Not an elegant solution, but displays what I want. reports.hist <- histogram(~ reports, data = CreditCard) income.hist <- histogram(~ income, data = CreditCard) sh

Re: [R] NAs error in caret function

2022-04-20 Thread javed khan
Carlos Ortega, thank you for your answer. Class label has three values (Bug, Codel smell and Vulnerability). X is a text-based feature that include English statements and we performed some preprocessing such as removing symbols, lower-case etc. Yes, train_label is a factor class. *I can provide

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Bert Gunter
If I understand you correctly, it's simple. Matrices in R are vectors with a dimension attribute. By default, they are populated column by column. Use 'byrow = TRUE to populate by row instead. For example: > matrix (1:36, ncol = 12, byrow = TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Bert Gunter
I believe I gave you sufficient information (the vector of dice roll results would replace 1:36 in my example). Furthermore, this sounds like homework, which we try not to do here. But even if it is not, I expect you to fill in the details based on what I have provided. If I have misunderstood your

Re: [R] Model To Simulate Dice Roll

2022-04-20 Thread Paul Bernal
Dear Bert, Thank you for your kind reply. That is fine, I appreciate your feedback anyway. Have a great day/night. Best, Paul El mié, 20 abr 2022 a las 23:31, Bert Gunter () escribió: > I believe I gave you sufficient information (the vector of dice roll > results would replace 1:36 in my exa

[R] Looping through all matrix columns each 1 row at a time

2022-04-20 Thread Paul Bernal
Dear R friends, One question, so, thanks to the Bert's kind feedback, I was able to create my matrix using the following code: dice_rolls = 120 num_dice = 1 dice_sides = 6 #performing simulation dice_simul = data.frame(dice(rolls = dice_rolls, ndice = num_dice, sides = dice_sides, plot.it = TRU