Displaying 20 results from an estimated 76 matches for "dfm".
Did you mean:
df
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="%...
2017 Jun 04
2
New var
...individual. This will be compared with
the actual measurements taken (Observed- expected) within each time
interval.
On Sat, Jun 3, 2017 at 9:50 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
> # 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
>...
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), ....
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"),
as.D...
2011 Aug 27
2
Am having trouble calling a function
...quot;="magenta","5"="orange")
shapes <- c(RF = "R", AF = "f", PH="H", PF = "P",
BA = "B", FI = "I", FF = "F", PS = "S", TC="T")
#Plot individual flight data
dfm = df
dfm = dfm[!df$MsgType=="AS",] # Eliminate AS messages
dfm$MsgType=drop.levels(dfm$MsgType)
dfm = dfm[as.numeric(dfm$PredTime) < 60.0,]
dfm$tc= as.factor(floor(dfm$PredTime/10.0)) # get 10-minute bin
dfm$flightfact = drop.levels(dfm$flightfact)
row.names(...
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 (dfm.names, dfm)
Error in rbind(depars...
2017 Jul 16
2
About doing figures
...2:50 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> 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)),
> fill=rainbow_colors)
> legend(25,35,c("DF=1","DF=2"),pch=c(1,19))
>
>...
2017 Jul 16
2
About doing figures
...values C, while
different colors label column A. Each record uses a circle on the figure,
while hollow circles represent DF=1 and solid circles represent DF=2. I put
my code below, but the A labels do not correspond to the true record, so I
don't know what is the problem. Thanks for your help.
dfm
dfm1= subset(dfm, DF==1)
dfm2= subset(dfm, DF==2)
plot(c(15:30),seq(from=0,to=60,by=4),pch=19,col=NULL,xlab='Value
B',ylab='Value C')
Color = as.factor(dfm1$A)
colordist = grDevices::colors()[grep('gr(a|e)y', grDevices::colors(),
invert = T)] # for unique colors
Color.unq =...
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)),
fill=rainbow_colors)
legend(25,35,c("DF=1","DF=2"),pch=c(1,19))
Jim
On Sun, Jul 16, 2017 at 3:43 PM,...
2017 Jul 16
0
About doing figures
...on at gmail.com> wrote:
>
>> 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)),
>> fill=rainbow_colors)
>> legend(25,35,c("DF=1","DF=2"...
2017 Jan 21
0
bug in rbind?
...n:
src/library/base/R/dataframe.R:1395.
https://github.com/wch/r-source/blob/01374c3c367fa12f555fd354f735a6e16e5bd98e/src/library/base/R/dataframe.R#L1395
The error is thrown because the line attempts to set a subset of the
rownames to NULL, which fails.
R> options(error = recover)
R> rbind(dfm.names, dfm)
Error in rownames(value[[jj]])[ri] <- rownames(xij) :
replacement has length zero
Enter a frame number, or 0 to exit
1: rbind(dfm.names, dfm)
2: rbind(deparse.level, ...)
Selection: 2
Called from: top level
Browse[1]> rownames(value[[jj]])
[1] "a" "b" &quo...
2014 Mar 06
1
Create dataframe in C from table and return to R
...ying 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] = {"aa","vv","gy"};
int sn[3] ={99,89,12};
char *listnames[2] = {"int","string"};
int i;
PROTECT(df = allocVector(VECSXP,2));
PROTECT(dfint = allocVector(INTSXP,3));
PROTECT(dfStr = allocVector(STRSXP,3));
PRO...
2011 Aug 11
2
Extract values from a data frame
Hi everyone,
I have a data frame that looks *sort of* like this:
name <- letters[1:5]
signal.1 <- c("12", "bad signal", "noise", "10", "X")
length.signal.1 <- 5:9
intensity.signal.1 <- 3:7
signal.2 <- c("13", "noise", "19.2", "X", "V")
length.signal.2 <- 2:6
intensity.signal.2
2023 May 25
1
data.frame with a column containing an array
...] ? ?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
? ? ?[,1] [,2]
[1,] ? ?7 ? 10
[2,] ? ?9 ? 12
?
## Now with df's
> DFA[["ar"]] <- ar
>
> DFM <- data.frame(id = 1:3)
> DFM[["M"]] <- matrix(1:6, nc =2)
>
> str(DFM)
'data.frame': 3 obs. of ?2 variables:
?$ id: int ?1 2 3
?$ M : int [1:3, 1:2] 1 2 3 4 5 6
> str(DFA)
'data.frame': 3 obs. of ?2 variables:
?$ id: int ?1 2 3
?$ ar: int [1:3, 1:2, 1:2]...
2023 May 09
1
data.frame with a column containing an array
...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
[,1] [,2]
[1,] 7 10
[2,] 9 12
## Now with df's
> DFA[["ar"]] <- ar
>
> DFM <- data.frame(id = 1:3)
> DFM[["M"]] <- matrix(1:6, nc =2)
>
> str(DFM)
'data.frame': 3 obs. of 2 variables:
$ id: int 1 2 3
$ M : int [1:3, 1:2] 1 2 3 4 5 6
> str(DFA)
'data.frame': 3 obs. of 2 variables:
$ id: int 1 2 3
$ ar: int [1:3, 1:2, 1:2]...
2018 May 23
1
legend order in ggplot2
...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)])
p2<-ggplot(dfm, aes(x=rep(1:2,4), y=value))
p2+geom_line(aes(linetype=variable))+
scale_linetype_manual(values=c("solid", "dashed", "dotted", "blank"),...
2006 Sep 20
4
Calculating mean together with split
Hi
I have a table called npl containing results of simulations.
It contains about 19000 entries and the structure looks like this:
NoPlants sim run year DensPlants
1 6 lng_cs99_renosterbos 1 4 0.00192
.
.
.
it has 43 different entries for sim and year goes from 1 to 100, and run
from 1 to 5.
I would like to calculate the mean of DensPlants for each
2023 May 25
3
data.frame with a column containing an array
...; ## array subscripting gives
> > ar[subs,,]
> , , 1
>
> [,1] [,2]
> [1,] 1 4
> [2,] 3 6
>
> , , 2
>
> [,1] [,2]
> [1,] 7 10
> [2,] 9 12
>
> ## Now with df's
> > DFA[["ar"]] <- ar
> >
> > DFM <- data.frame(id = 1:3)
> > DFM[["M"]] <- matrix(1:6, nc =2)
> >
> > str(DFM)
> 'data.frame': 3 obs. of 2 variables:
> $ id: int 1 2 3
> $ M : int [1:3, 1:2] 1 2 3 4 5 6
> > str(DFA)
> 'data.frame': 3 obs. of 2 variables:
>...
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 dataframe:
dfc <- cast(dfm, Var1 + Var2 + Var3 + Var4 ~ species,max) # with reshape
dfc <- dcast(dfm, Var1 + Var2 + Var3 + Var4 ~ species,max) # with reshape2
but then I get (this is new to resh...
2008 Nov 23
1
Help in Programming using Methods
...1.38, 1.30, 1.85, 1.09, 1.13, 1.06,
1.86, 1.70, 1.81, 1.54, 1.67, 0.88,
2.27, 1.81, 2.01, 1.40, 1.31, 1.06,
1.75, 1.95, 2.13, 1.78, 1.31, 1.30,
1.52, 1.47, 1.80, 1.37, 1.01, 1.31,
1.55, 1.61, 1.82, 1.56, 1.23, 1.13,
1.56, 1.72, 1.99, 1.55, 1.51, 1.33)
dfm <- data.frame(var, sub, man, blo, y)
te <- test(dfm, model = 'y ~ blo + man*var + Error(blo/var)',
which = 'man', error ='Within' )
THE RESULT AFTER TRYING TO RUN test IS :
Error in formula(model) : object "model" not found
IF I TRY THIS...