R table with where condition [closed] - r

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have a simple table (age by marital status) for individuals in a range of geographical zones.
I'd like to produce a table for each of these, would this be possible to do using a where statement, something along the lines of :
table(age, marital status)
where geo="Town A"

Related

How to input two-way data tables from Excel into R? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 days ago.
Improve this question
I have been trying to input a two way data table from Excel into R.
I was using read_excel for this purpose, but it is not inputting the table correctly. Any ideas on which code to use?

Specific variables calculation [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
Hello,I have an issue.I have an excell and I want to calculate and to find Min. =0.000 etc..but I find Min. =1.700 etc. What am I doing wrong here?
I believe the problem is your inclusion of & grade as a term in your filter step.
What's going on is that R wants to interpret each of these terms (exam=="S1", year==2018, grade) as a logical value. When it converts grade to logical, 0 becomes FALSE and all other values become TRUE (try as.logical(-1:1) to see an example), so the zero values in your data get removed.
Just delete & grade from your code.

Easy Function to plot equation of abline [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am beginner in R and i have a simple regression. Now i want to plot the equation of the regression line into the plot. The most easiest way. I already tried to get it done by following some ideas here.
DICE_Quartal<-read.csv("")
attach(DICE_Quartal)
plot(Preise.Fernbusmarkt ~ Auskunftpflichtige.Unternehmen) + abline(cor_preis_unternehmen, col = "red")

Conditional apply() in r [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am struggling to create a variable based on a condition in my data frame.
I think the code is quite self-explanatory.
DT$xp_ratio_y<- apply(DT,1,function(x)
if(DT$driv_y_add_flg==1) {
x=DT$driv_y_experience/DT$driv_y_age
} else {
x=0
}
)
I think you're making it too complicated. Just calculate for all then remove those you don't want:
DT$xp_ratio_y <- DT$driv_y_experience/DT$driv_y_age
DT$xp_ratio_y[DT$driv_y_add_flg !=1 ] <- 0

Can someone explain the following snippet of R code? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Specifically, what the 3rd line of code does and how does 'train[train$label==1,]' work
train <- read.csv("../input/train.csv")
set.seed(71)
data <- sample(as.integer(row.names(train[train$label==1,])),100)
par(mfrow=c(10,10),mar=c(0.1,0.1,0.1,0.1)) ---- 3
It subsets the train dataset to only observations where label = 1.

Resources