Questions tagged [levels]
491 questions
-2
votes
1 answer
Find regex matches in the names of factor levels in a df in R
I have a dataframe with factors. These factors have some levels.
I could not find exact matches based on their names using regex.
df <- structure(list(age = structure(1:2, .Label = c("18-25",
">25"), class = "factor"), `M` =…

Estatistics
- 874
- 9
- 24
-2
votes
1 answer
Plotting in R for each level or category
I have a data set that contains data on number of child deaths (cdeaths) listed by country and by year. How do I generate individual scatter plots (cdeaths by year) for each country without having to do it manually? I have 186 countries so I was…

Lisa
- 3
- 3
-2
votes
1 answer
How to reorder levels
I have the following dataframe:
Accession Order
1 CP000517 7
2 CP002081 8
3 CP002427 9
4 CP002429 10
5 CP002430_plasmid 11
6 CP003799 12
7 CP009907 13
8 CP009908_plasmid 14
9 …

Michael
- 706
- 9
- 29
-2
votes
1 answer
How do I create a barplot for a specific factor in a data frame?
Let's say I have a data frame as follows
Gender Score
Male 1
Female 2
Male 4
Male 3
Female 5
How would I create a barplot that only plotted the scores for males?

Ricky Su
- 295
- 1
- 7
- 10
-2
votes
1 answer
levels preserved in subset, how to remove
I took out single factor subset from a.df, which has 38 levels in field 'Rh_spps'
but in new subject, when I check levels, it gives whole list, while there is only one level
here area detail code
rr.lepp<-a.df[a.df$Rh_spps=="R. lepidotum",]…

MKS
- 13
- 1
- 4
-2
votes
1 answer
How to assign different colours to the "levels" of a cylinder in MatLab
As the title says, I need to specify different colours for the segments composing a cylinder in MatLab.
I built my cylindric structure using this .m file on File…

Vittorio
- 11
- 3
-2
votes
1 answer
Images as game levels
I have been searching the past few days but can't seem to find anything on how to read .png files and then build levels off of that. I already know how to load images and files, but how does one go about pulling data out of them in order to build…

x3zinja12
- 21
- 1
- 1
- 5
-3
votes
2 answers
Delete, drop, kill ALL factor levels from Dataframe
Lets take mtcars as example and create a new variable:
mtcars$name <- rownames(mtcars)
mtcars[,] <- lapply(mtcars, factor)
mtcars[,] <- lapply(mtcars, as.numeric)
Now the names are converted into numerics which i definitely dont want
> mtcars
…

Andre Elrico
- 10,956
- 6
- 50
- 69
-3
votes
2 answers
level based on bigger factor
Here are the sample data.
df1 <- data.frame(y = 1:5, x = c("s", "m", "l", "s", "m"))
df2 <- data.frame(y = 1:4, x = c("s", "l", "s", "l"))
I'd like df2 has three levels based on df1$x.
I tried
df2$x <- factor(df1$x)
Then I've got
Error in…

microbe
- 2,139
- 3
- 14
- 17
-6
votes
1 answer
Adding difficulty levels into Java Chess Game
I am currently working on developing a Java Chess Game and have the game up and running correctly. But I want to add a function at the start where the user is able to select which difficulty they want to play at. I would like to add 3 difficulties,…

Ryan Scollard
- 45
- 1
- 4
- 11