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
This is very nice to learn about, Denis, but it seems only fair to point out
that the result of rbindlist is not a data frame. You can convert it to a data
frame easily, but the copy and indexing semantics of data tables are quite
different than data tables, which could be a real headache for s
Sebastian:
This is somewhat arcane, perhaps even a bug (correction on this
welcomed). The problem is that the "expr" argument to curve() must be
an actual expression, not a call to parse that evaluates to an
expression. If you look at the code of curve() you'll see why
(substitute() does not evalu
Dear R Help folks --
I have been trying to put together a list of the steps or stages of R
function evaluation, with particular focus on those that have "standard" or
"nonstandard" forms. This is both for my own edification and also because I
am thinking of joining the world of R bloggers and have
Hi,
Down a cascade of function calls, I want to use the curve function with an
expression that is a variable. For various reason, this variable must be a
character object and cannot be an expression as required by the curve function.
How do I convert my variable into a expression that is accep
Typo: dat[[z]] should be x[[z]]:
x2 <- do.call(rbind, lapply(names(x), function(z)
data.frame(type=z, x[[z]])))
x2
type x y
1A 1 3
2A 2 4
3B 5 7
4B 6 8
David C
-Original Message-
From: R-help On Behalf Of David L Carlson
Sent: Wednesday, May 2, 2018 3:51 PM
To:
This might be faster. It uses apply() which is just another way of constructing
a loop so it is not necessarily faster. We can vectorize the logical
comparisons, but all() is not vectorized. Use dput() to share your data. That
makes it easier to replicate your example:
a <- structure(list(V1. =
Or add the type column first and then rbind:
x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
x2 <- do.call(rbind, lapply(names(x), function(z)
data.frame(type=z, dat[[z]])))
David L Carlson
Department of Anthropology
Texas A&M Univer
Hi Neha,
Perhaps merge() from base or join from dplyr is what you are looking for.
data. table could also be interesting.
Hth
Ulrik
On Wed, 2 May 2018, 21:28 Neha Aggarwal, wrote:
> Hi
>
> I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
> for dataframe a and b and the
On 05/02/2018 07:11 PM, Kevin E. Thorpe wrote:
I suspect this is pretty easy, but I'm having trouble figuring it out.
Basically, I have a list of data frames such as the following example:
list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
I would like to turn this into data frame w
Hi
I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
for dataframe a and b and then input the rows ids to datframe c . In the if
condition, I AND the 2 rows of from a and b and then see if the result is
equal to one of them.
I have done this using a for loop, however, it ta
Another approach:
library(tidyr)
L <- list( A = data.frame( x=1:2, y=3:4 )
, B = data.frame( x=5:6, y=7:8 )
)
D <- data.frame( Type = names( L )
, stringsAsFactors = FALSE
)
D$data <- L
unnest(D, data)
#> Type x y
#> 1A 1 3
#> 2A
On Wed, 2 May 2018, Kevin E. Thorpe wrote:
I suspect this is pretty easy, but I'm having trouble figuring it out.
Basically, I have a list of data frames such as the following example:
list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
I would like to turn this into data frame where
> x1 <- do.call(rbind, c(x, list(make.row.names=FALSE)))
> x2 <- cbind(type=rep(names(x), vapply(x, nrow, 0)), x1)
> str(x2)
'data.frame': 4 obs. of 3 variables:
$ type: Factor w/ 2 levels "A","B": 1 1 2 2
$ x : int 1 2 5 6
$ y : int 3 4 7 8
Bill Dunlap
TIBCO Software
wdunlap tibco.co
Hi Kevin,
There is probably a better way, but it can be done in two steps like this
temp <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
temp <- lapply(names(temp), function(n, temp) {
temp[[n]]$type <- n
return(temp[[n]])
}, temp = temp)
do.call(rbind, temp)
On Wed, May 2,
I suspect this is pretty easy, but I'm having trouble figuring it out.
Basically, I have a list of data frames such as the following example:
list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
I would like to turn this into data frame where the list elements are
essentially rbind'ed t
Have a look at anti_join() from the dplyr package. It does exactly
what you want. Here is an example based on the code of Robin
Table_A <- as.data.frame(Table_A, stringsAsFactors = FALSE)That is
Table_B <- as.data.frame(Table_B, stringsAsFactors = FALSE)
library(dplyr)
anti_join(Table_A, Table_B,
Hi,
I'll coded your example into R code:
Table_A <- c('a...@gmail.com', 'John Chan', '0909')
Table_A <- rbind(Table_A, c('b...@yahoo.com', 'Tim Ma', '89089'))
colnames(Table_A) <- c('Email', 'Name', 'Phone')
Table_A
Table_B <- c('a...@gmail.com', 'John Chan', 'M', '0909')
Table_B <- rbind(Table_
Thanks - Peter, Eivind, Rui
Sorry, I perhaps could not explain it properly in the first go.
Trying to simplify it here with an example - Say I have two dataframes as
below that are NOT equally-sized data frames (i.e., number of columns are
different in each table):
Table_A:
Email
> Eivind K Dovik
> on Tue, 1 May 2018 23:18:51 +0200 writes:
> You may also want to check this out:
> plot(ttt, type = "p")
> points(ttt, col = ifelse(ttt < 8, "black", "red"))
> Eivind K. Dovik
> Bergen, NO
yes, indeed, or -- even nicer for a time series:
usin
20 matches
Mail list logo