similar to: how to delete specific rows in a data frame where the first column matches any string from a list

Displaying 20 results from an estimated 1100 matches similar to: "how to delete specific rows in a data frame where the first column matches any string from a list"

2009 Feb 25
2
: record which entry in one file doesn't appear in a different file
Hi dear list, If anybody could help me, it would be great! I have two files: File 1 is a list (one column and around 100000 rows) File 2 is a list with all the names from file one and a few more (one column and more than 100000 rows) What I want is to add a column in file 2 that says which name appeared in file 1 and which doesn't (yes and no would work as a code) It's very important to
2010 Feb 23
3
how to rearrange a dataframe
Hi all, I'd appreciate if anyone can help me with this... I have a data frame that looks like this: 1 + name1 1 2 3 2 + name2 5 9 10 2 - name3 56 74 93 1 - name4 65 75 98 I need to rearrange this in a way so that the rows with "1" in the first column, and "-" in the second column; then columns 4 and 6 should switch places. That is, column 6 would be now column 4 and
2006 Sep 18
8
acos(0.5) == pi/3 FALSE
Hello, I don't know if the result of acos(0.5) == pi/3 is a bug or not. It looks strange to me. Inaki Murillo
2018 Mar 12
7
Equivalent of gtools::mixedsort in R base
Hi, Searching for functions that would order strings that mix characters and numbers in a "natural" way (ie, "a1 a2 a10" instead of "a1 a10 a2"), I found the mixedsort and mixedorder from the gtools package. Problems: 1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does 2- gtools has not been updated in 2.5
2018 Apr 09
3
Question about subset
Hi, The help page for subset states "subset: logical expression indicating elements or rows to keep: missing values are taken as false." Before I try to re-invent the wheel, I would like to know if one of the base or recommended packages would contain a variant of the subset function that would consider missing values as true. Thanks
2011 Dec 20
2
any DCCA function in R?
Dear members, I am performing multivariate analysis on marine benthic populations using R. At first glance I found ca and VEGANO packages to be the suitable for the task, but neither has incorporated Detrended Canonical Correspondence Analysis (DCCA), which is just the method I want to apply on my data. I've looked for alternative packages containing the method, but my suspicion is that
2012 Mar 20
1
scientific notation in a data frame
Dear list, I have a data frame where one of the columns are p values with scientific notation mixed with regular numbers with decimals. >a=data frame >a P OR N 0.50 0.7500 237 0.047 1.1030 237 0.124 0.7742 237 0.124 0.7742 237 0.0080 1.1590 237 0.50 0.7500 237 4.5e-07 1.2 237 5.6e-04 0.9 237 when I try to do >pval=a$P/2 R gives me an error saying "In Ops.factor(pval, 2)
2009 Feb 03
2
Numeric class and sasxport.get
Dear R-users, The sasxport.get function (from the Hmisc package) automatically defines the class of imported variables. I have noticed that the class of theoretically numeric variables is simply "labelled", although character variables might end up been defined as "labelled" "Date" or "labelled" "factor". Is there a way to tell sasxport.get to
2009 May 14
1
Problem with viewports, print.trellis and more/newpage
Dear R-users, I have got the following problem. I need to create 4x2 arrays of xyplot's on several pages. The plots are created within a loop and plotted using the print function. It seems that I cannot find the proper grid syntax with my viewports, and the more/newpage arguments. The following script is a simplification but hopefully will suffice to illustrate my problem. Any suggestion
2009 Apr 28
1
Understanding padding in lattice
Dear R-users, I am trying to understand what the different padding arguments in trellis.par.set are exactly controlling the space around lattice plots. I have used the following code as a basis for testing but it did not really help me to visualize how the value of each argument changes the margins and the plotting area. I guess a better way to visualize the effects of these padding items
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does This is tangential, but do.call(order, mydataframe) is not safe to use in a general purpose function either - you need to remove the names from the second argument: > d <- data.frame(method=c("New","New","Old","Old","Old"),
2018 Apr 09
0
Question about subset
Sent from my iPhone > On Apr 8, 2018, at 9:06 PM, Sebastien Bihorel <sebastien.bihorel at cognigencorp.com> wrote: > > Hi, > > The help page for subset states "subset: logical expression indicating elements or rows to keep: missing values are taken as false." > > Before I try to re-invent the wheel, I would like to know if one of the base or recommended
2009 Apr 20
3
How to force axis to have the same range
Dear R-users, I am trying to produce (standard and trellis) scatterplots which use the same range of the x and y axes. In addition, I would like the plots to be physically square. Is there one or more specific argument(s) to plot and xyplot what would do that? I have looked at various combinations of asp and pin value, but could not get what I wanted.. Thank you in advance for your help
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
split any mixed columns into letter and number columns and then order can be used on that: DF <- data.frame(x = c("a10", "a2", "a1")) o <- do.call("order", transform(DF, let = gsub("\\d", "", x), no = as.numeric(gsub("\\D", "", x)),
2009 Feb 17
1
:How to insert a column in a data frame
Hi dear list, I wonder if somebody can help me with this. I have a text file with 300 rows and around 300000 columns and I need to insert a column that has the number 1 in every row. This new column should be placed between columns 6 and 7. As an example: I would want to insert a column (consiting just of the number 1 in every row, as in column 6) between columns 6 and 7. 847 847 0 0 2 1 G G T
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
??? > y <- sort( c("a1","a2","a10","a12","a100")) > y [1] "a1" "a10" "a100" "a12" "a2" > mixedsort(y) [1] "a1" "a2" "a10" "a12" "a100" **Please read the docs!** They say that mixedsort() and mixedorder() both take a **single
2011 Aug 31
3
How to modify the dot-dot-dot argument using level names instead of position
Dear R-users, In the R internals manual, it is said that one can extract the elements of the dot-dot-dot argument using the special symbols ..1 or ..2. It seems to work just fine but I was wondering if there is a way one can extract or modify the content of the dot-dot-dot argument using a level name instead of its position? For instance, assuming that list(...) returns: $a [1] 1 2 3 4 5
2009 Aug 21
2
Problem with passing a string to subset
Dear R-users, The following question bothered me for the whole afternoon: how can one pass a string as the conditioning argument to subset? I tried plain mystr, eval(mystr), expression(mystr), etc... I don't to be able to find the correct syntax > foo <- data.frame(a=1:10,b=10:1,c=rep(1:2,5)) > mystr<-"c==1" > subset(foo,c==1) a b c 1 1 10 1 3 3 8 1 5 5 6
2009 Sep 02
2
combining grid.text, expression and variables
Dear R-users, I am trying to use the grid.text and expression functions to display several character strings and plotmath text on a viewport. Some strings can include a variable portion (PI.limits in the following example), which I thought could be implemented by combining the bquote and the expression functions. Unfortunately, my expressions do not seem to be evaluated. I would greatly
2018 May 03
1
Calling the curve function with a character object converted into an expression
Typo: should be NULL not NUL of course An alternative approach closer to your original attempt is to use do.call() to explicitly evaluate the expr argument: w <- "1 + x^2" do.call(curve, list(expr = parse(text = w), ylab ="y")) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus