I am trying to determine which variables in my V1 column have values in the V5 column that are in the range of 95-105 and also have values in the V6 column that are in the 7-13 range. I am using the which function and attempting to store the names of the variables in V1 under the variable x but I keep getting the output integer(0) or character(0) and I'm not sure what that means. An image of my code is attached below.
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
integer(0)
means there are no elements of your data frame that satisfy the conditions. (You could try(edited on the basis of @H1's comment, to match your description rather than your code); rearranging slightly to approximate the
A < B < C
syntax that R's parser can't handle ...)You should probably check
str(df)
and/orsummary(df)
(orsapply(df, class)
) to make sure that your data frame has really been read in as intended (or usedplyr::read_csv()
, which prints information about the classes inferred from the data set. In particular, any typos in your data that make an entry not be a valid number (extra decimal point, missing value such as "?" not recognized as missing, etc.) will make R interpret the entire column as a character (since you've setstringsAsFactors=FALSE
) rather than a numeric variable.If you want to force columns 2-14 to numeric, you can use
df[-1] <- lapply(df[-1], as.numeric)
however, it would be better practice to find and fix any problems upstream ...