Hello Ulrik and Jeff
Thank you for replying.
I succeed to create data frame following steps.
s <- structure(list(ID = c(101L, 102L, 103L, 103L), DATE = c(20160301L,
20160301L, 20160301L, 20160302L), VAR = c(1L, 1L, 1L, 1L), CODE =
structure(c(1L,
2L, 3L, 3L), .Label = c("PDT1", "PDT2", "PDT3"),
You could make a vector with all possible IDs. Use %in% to get just those
that are missing.
missing.id <- c (101:1000)
missing.id <- missing.id[! missing.id %in% s $ID]
Df2 <- data.frame(ID = missing.id,
CODE = paste0 (PDT, missing.id),
VAR = 0)
Modify your original data.frame so you can rind df
Suggested reading
An Introduction to R, section 5.3
The Posting Guide, mentioned at the bottom of this message, which mentions that
this is a pain text mailing list so don't post in HTML (it gets mangled).
--
Sent from my phone. Please excuse my brevity.
On March 24, 2016 10:09:46 PM PDT, Hiro
Hello Ulrik
Thank you for replying.
The real data has many IDs( about 3,000 IDS). So I want to find missing
values with function or something.
If 104 not in s, then add 104 value with all column zero.
And also real data has many columns( 80 ~ 5,000, columns. it is not fixed
length ).
So I would
Hi Hiroyuki,
The row bind function rbind() is what you need
s <- dcast(s,ID ~ CODE, value.var="VAR",sum)
df2 <- data.frame(ID = c(104, 105), PDT1 = 0, PDT2 = 0, PDT3 = 0)
rbind(s, df2)
hope this helps
Ulrik
On Fri, 25 Mar 2016 at 05:52 Hiroyuki Sato wrote:
> Hello members
>
> Question
>
> Co
Hello members
Question
Could you tell me how to add ID 100, 104, 105 values with zero?
1, Source data
ID 100, 104 and 105 has no values.
> s
ID DATE VAR CODE
1 101 20160301 1 PDT1
2 102 20160301 1 PDT2
3 103 20160301 1 PDT3
4 103 20160302 1 PDT3
s <- structure(list(ID = c(101L, 102L, 103L,
#I am having a lot of trouble reshaping this data.
#This is just an examination of sample size on the margin of error that I
did for a colleague.
#Nothing complicated.
#But restructuring the data...another story
#Here's code to produce the dataset:
n <- seq(1, 10, by=1)
P <- seq(0.1
Hannah,
Let me see if I can understand your question.
You have 10 observations of a single variable (perhaps some sort of price?).
You also have an equivalence matrix between these observations (which you
possibly called nodes) which stipulates if they are connected together or not.
Given tha
If the number of values are always the same, the proposed strategies will work
for you. If they are not the same, you need a completely different approach.
Most importantly, you will need to figure out which columns correspond to
missing values. Is it always the last ones that are dropped? If no
Hi, I am a new R user. I have seen the use of kmeans in clustering.
However, I would like to ask how I can add more constraints to the kmeans.
For example, I have a set of data for a 10 nodes network,
price = c(84, 96, 57, 53, 90, 94, 81, 66, 93, 54)
I want to use K mean to to group this set of d
> Hello Everyone : i have done the clustering process by k-means cluster,
> then i
> try to save[Export ] the groups of clustering, to txt, or CSV files , how i
> can do
> that
Depends what you want.
You can save the whole object for reloading using save()
The cluster members can be written
1. I cannot find a question here. Maybe I missed it. Maybe you should
be clearer.
2. You should most this on the mixed-models list, rather than here:
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep co
Hi again
Is there any way to check the relations between dbFD indexes?
Function cor for example? I can't manage to put the informations correctly
I want to see the relationships between the dbFD output (nbsp, sing.sp,
FRic, FEve, FDiv, FDis and RaoQ)
How should I type it?
Thank you
Fábio
201
You are unlikely to get help on this without a reproducible example. One
obvious possibility is that those values are already optimal. Another is that
you are not invoking the optimization properly.
--
Sent from my phone. Please excuse my brevity.
On March 24, 2016 5:13:35 AM PDT, Anusha Kotha
Thanks to Boris Steipe, Jim Lemon and Ivan Calandra for replying.
I messed up while copying, there are equal number of values for each
country.
@ Ivan,
In case there were different number of values, and we wanted to fill in with
1) NA, or
2) "average of the rest of values"
in the missing valu
On 24/03/2016 8:13 AM, Anusha Kothapalli wrote:
-- Forwarded message --
From: *Anusha Kothapalli*
Date: Wednesday, March 23, 2016
Subject: question on constrOptim
To: r-c...@r-project.org
To Whom It May Concern,
We are using constrOptim to maximize a log likelihood function. T
-- Forwarded message --
From: *Anusha Kothapalli*
Date: Wednesday, March 23, 2016
Subject: question on constrOptim
To: r-c...@r-project.org
To Whom It May Concern,
We are using constrOptim to maximize a log likelihood function. The
constrOptim call returns values, however, they
>
>
> I would like to do an internal validation of a discriminative ability of a
> mixed effects models.
>
> Here is my scrip:
>
> ###
> bootMer-> boot AUC#
> ###
>
> library(lme4)
> library(lattice)
> data(cbpp)
>
> #fit a model
>
>
Hello Everyone : i have done the clustering process by k-means cluster, then
i try to save[Export ] the groups of clustering, to txt, or CSV files , how i
can do that #clusrer.data <-
function(data,n) {
miRNA.exp.cluster <- scale(t(miRNA.exp))
k.means.fi
Thanks for the precision.
On 3/24/2016 10:40 AM, Duncan Murdoch wrote:
On 24/03/2016 10:28 AM, sbihorel wrote:
Hi,
Thanks for your suggestion.
missing(x) works only if x is not altered within the function, which is
not the case in my actual function (which is more complex than the
example fun
> Are you aware of any function what would query the original function call
> arguments no matter what happens in the function?
Use missing() first.
If you can't use missing() first, or use it early in a parent function and pass
a flag, you could perhaps pass a copy of the parent function call t
On 24/03/2016 10:28 AM, sbihorel wrote:
Hi,
Thanks for your suggestion.
missing(x) works only if x is not altered within the function, which is
not the case in my actual function (which is more complex than the
example function I send in my previous post).
That's not quite true: missing(x) w
The problem was that this was in a Docker container which is based on a
strip down base image. While I had restored glibc-common and its locale
information, there was still stuff removed from glibc that was required.
Reinstalled it and building cleanly.
Thanks, Neale
On 3/23/16, 11:53 PM, "David
Hi,
Thanks for your suggestion.
missing(x) works only if x is not altered within the function, which is
not the case in my actual function (which is more complex than the
example function I send in my previous post).
Are you aware of any function what would query the original function
call
Neat!
It would be nice to complete dzipois() with the corresponding rzipois()
and pzipois() functions. I would have found these useful in my new book,
http://ddar.datavis.ca
-Michael
On 3/23/2016 11:27 AM, Martin Maechler wrote:
Thierry Onkelinx
on Tue, 22 Mar 2016 13:58:09 +0100 write
Don't provide a default value for c in the parameter list. Then you can use
the missing() function to make decisions, including whether to generate a
default value for c or not.
--
Sent from my phone. Please excuse my brevity.
On March 24, 2016 5:11:43 AM PDT, sbihorel
wrote:
>Hi,
>
>Please
Hi,
Please consider the following functions:
myf1 <- function(x,fun){
if (is.null(fun)){
x
} else {
do.call(fun, list(x))
}
}
myf2 <- function(a=1, b=2, fun=NULL, c=myfun1(b,fun)){
if (myf1(b,fun)>0 & ){
c <- b
}
print(list(a,b,c))
}
myf2(a=2,b=3,fun=exp)
myf2(a=2,b=3,
> William Dunlap via R-help
> on Wed, 23 Mar 2016 13:56:35 -0700 writes:
> I don't know what is in R's poly(), but if it is like S+'s or TERR's then
> one could do
> if (anyNA(x)) {
> nax <- na.exclude(x)
> px <- poly(x = nax, degree = degree, coefs = coefs, raw
Hi!
As Boris explained, if you do not always have the same number of values
per country, you need to provide more details, e.g. should the empty
cells be filled with NA?
But if you do always have 20 values per country (unlike in your sample
data), then this could work for you:
mydf <- data.
Hi Burhan,
As all of your values seem to be character, perhaps:
country.df<-as.data.frame(matrix(temp.data,ncol=22,byrow=TRUE)[,2:21])
if there really are 2 country names and 20 values for each country. As
Boris has pointed out, there are different numbers of values following
the country names in
Your data rows have different numbers of columns. Thus your problem is not
sufficiently specified.
B.
On Mar 24, 2016, at 6:30 AM, Burhan ul haq wrote:
> Hi,
>
> 1. I have scraped some data from the web, subset shown below
>
>> dput(temp.data)
> c("Armenia", "Armenia", "43827", "39200", "357
Hi,
1. I have scraped some data from the web, subset shown below
> dput(temp.data)
c("Armenia", "Armenia", "43827", "39200", "35700", "36700", "39341",
"30571", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", " 0",
"0", "0", "0", "0", "Austria", "Austria", "135417", "166200",
"144500", "147300"
32 matches
Mail list logo