Displaying 20 results from an estimated 500 matches similar to: "About doing figures"
2017 Jul 16
2
About doing figures
Hi Jim,
For true color, I meant that the points in the figure do not correspond to
the values from the dataframe. Also, why to use rainbow(9) here? And the
legend is straight in the middle, is it possible to reformat it to the very
bottom? Thanks again.
On Sun, Jul 16, 2017 at 2:50 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> Hi lily,
> As I have no idea of what the "true
2017 Jul 16
0
About doing figures
Hi lily,
As I have no idea of what the "true record" is, I can only guess.
Maybe this will help:
# get some fairly distinct colors
rainbow_colors<-rainbow(9)
# this should sort the numbers in dfm$A
dfm$Acolor<-factor(dfm$A)
plot(dfm$B,dfm$C,pch=ifelse(dfm$DF==1,1,19),
col=rainbow_colors[as.numeric(dfm$Acolor)])
legend("bottom",legend=sort(unique(dfm$A)),
2017 Jul 16
0
About doing figures
For more than 10 records, how to reformat the colors? Also, how to show the
first legend only, but at the bottom, while the second legend in your code
is not necessary? In all, the same A values have the same color, but
different symbols in DF==1 and DF==2.
Thanks for your help.
On Sun, Jul 16, 2017 at 9:28 AM, lily li <chocold12 at gmail.com> wrote:
> Hi Jim,
>
> For true color,
2010 Aug 11
1
sem & psych
Dear R users,
I am trying to simulate some multitrait-multimethod models using the
packages sem and psych but whatever I do to deal with models which do not
converge I always get stuck and get error messages such as these:
"Error in summary.sem(M1) : coefficient covariances cannot be computed"
"Error in solve.default(res$hessian) : System ist f?r den Rechner singul?r:
reziproke
2017 Jun 04
0
New var
# read.table is NOT part of the data.table package
#library(data.table)
DFM <- read.table( text=
'obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004
',header = TRUE, stringsAsFactors = FALSE)
# cleaner way to compute D
DFM$start <- as.Date( DFM$start, format="%m/%d/%Y" )
DFM$end
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this?
Starting with Jeff's initial DFM:
DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152,
13787, 15126, 12696), class = "Date"), end = structure(c(17167,
14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700,
265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L,
1L), .Label
2017 Jun 04
2
New var
Thank you Jeff and All,
Within a given time period (say 700 days, from the start day), I am
expecting measurements taken at each time interval;. In this case "0" means
measurement taken, "1" not taken (stopped or opted out and " -1" don't
consider that time period for that individual. This will be compared with
the actual measurements taken (Observed-
2011 Aug 27
2
Am having trouble calling a function
In my main R program, I have
source("retaanalysis/Functions/doAirport.R")
.... stuff to read data and calculate ads
sapply(ads, function(x) {doAirport(x, base)} )
And doAirport has
# analyze the flights for a given airport
doAirport = function(df, base) {
# Get rid of unused runway factor levels (from other airports)
df$lrw <- drop.levels(df$lrw) # In gdata package
#
2017 Jan 17
2
bug in rbind?
I suspect there may be a bug in base::rbind.data.frame
Below there is minimal example of the problem:
m <- matrix (1:12, 3)
dfm <- data.frame (c = 1 : 3, m = I (m))
str (dfm)
m.names <- m
rownames (m.names) <- letters [1:3]
dfm.names <- data.frame (c = 1 : 3, m = I (m.names))
str (dfm.names)
rbind (m, m.names)
rbind (m.names, m)
rbind (dfm, dfm.names)
#not working
rbind
2014 Mar 06
1
Create dataframe in C from table and return to R
Hi ,
I am trying to create a dataframe in C and sebd it back to R. Can anyone
point me to the part of the source code where it is doing , let me explain
the problem I am having .
--------------------------------------------------------------------
My simple implementation is like this
SEXP formDF() {
SEXP dfm ,df , dfint , dfStr,lsnm;
char *ab[3] =
2017 Jun 03
2
New var
Thank you all for the useful suggestion. I did some of my homework.
library(data.table)
DFM <- read.table(header=TRUE, text='obs start end
1 2/1/2015 1/1/2017
2 4/11/2010 1/1/2011
3 1/4/2006 5/3/2007
4 10/1/2007 1/1/2008
5 6/1/2011 1/1/2012
6 10/5/2004 12/1/2004',stringsAsFactors = FALSE)
DFM
DFM$D =as.numeric(difftime(as.Date(DFM$end,format="%m/%d/%Y"),
2023 May 25
1
data.frame with a column containing an array
So is this an expected behavior or is it a bug which should be reported somewhere else?
Thanks!
Georg?
?
?
Gesendet:?Dienstag, 09. Mai 2023 um 19:28 Uhr
Von:?"Bert Gunter" <bgunter.4567 at gmail.com>
An:?"Georg Kindermann" <Georg.Kindermann at gmx.at>
Cc:?"Rui Barradas" <ruipbarradas at sapo.pt>, r-help at r-project.org
Betreff:?Re: [R] data.frame
2012 Feb 13
1
comment lines sometimes removed from a function on exit from internal R editor
Dear All -
The problem: comment lines in an R function (lines beginning with # ) are *sometimes* removed on leaving the R default editor (same with notepad).
I'm working on a Windows machine with R version 2.14.1.
An example is below. Couldn't find anything that seemed to relate to this in the Changelog. I don't recall encountering this behavior with previous versions of R. Any
2023 May 09
1
data.frame with a column containing an array
I think the following may provide a clearer explanation:
subs <- c(1,3)
DFA <- data.frame(id = 1:3)
ar <- array(1:12, c(3,2,2))
## yielding
> ar
, , 1
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
, , 2
[,1] [,2]
[1,] 7 10
[2,] 8 11
[3,] 9 12
## array subscripting gives
> ar[subs,,]
, , 1
[,1] [,2]
[1,] 1 4
[2,] 3 6
, , 2
2018 May 23
1
legend order in ggplot2
Hi,
I ran your code, but the results were not as expected. After I ran the
code by "source", it return
No id variables; using all as measure variables
> p2
and no line or legend is on the graph (as attached)
Am I doing anything wrong?
John
library(ggplot2)
library(reshape2)
dfm<-melt(df)
dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
2023 May 25
3
data.frame with a column containing an array
I really don't know. I would call it a request for extended capabilities of
[.data.frame, rather than a feature or bug. But maybe wiser heads than mine
who monitor this list can sort it out.
-- Bert
On Wed, May 24, 2023 at 8:52?PM Georg Kindermann <Georg.Kindermann at gmx.at>
wrote:
> So is this an expected behavior or is it a bug which should be reported
> somewhere else?
>
2008 Nov 23
1
Help in Programming using Methods
I WROTE THIS FUNCTION BELOW
test <- function(x, ...) UseMethod('test', x)
test.data.frame = function(x, model, which, error, ...)
{
av <- aov(formula(model), data = x)
res <- test.aovlist(av, which = which, error = error)
return(res)
}
test.aovlist <- function(x, which, error, ...)
{
mm <- model.tables(x, "means")
tabs <- mm$tables[-1]
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi,
I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before.
What I did/want to do:
1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far:
dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE)
2) Recast the
2018 May 22
0
legend order in ggplot2
Hi
Your approach seems to me rather complicated. I would reshape data before plotting and maybe also change order of levels in resulting variable factor
library(reshape2)
dfm<-melt(df)
dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
p2<-ggplot(dfm, aes(x=rep(1:2,4), y=value))
p2+geom_line(aes(linetype=variable))+
2014 Jun 25
1
Need help on calling Head from C
Hi ,
I am trying to call head function from C . My doubt is with the parameter
n,how to pass it .
PROTECT(dfm=lang3(install("data.frame"),df,ScalarLogical(FALSE)));
SET_TAG(CDDR(dfm), install("stringsAsFactors")) ;
SEXP res = PROTECT(eval(dfm,R_GlobalEnv));
PROTECT(head=lang3(install("head"),res,ScalarInteger(1)));
head = PROTECT(eval(head,R_GlobalEnv));
I tried