Displaying 20 results from an estimated 43 matches for "mydata2".
Did you mean:
mydata
2006 Feb 20
3
Boxplot Help for Neophyte
R helpers
I am getting to grips with R but came across a small problem today that I
could not fix by myself.
I have 3 text files, each with a single column of data. I read them in
using:
myData1<-scan("C:/Program Files/R/myData1.txt")
myData2<-scan("C:/Program Files/R/myData2.txt")
myData3<-scan("C:/Program Files/R/myData3.txt")
I wanted to produce a chart with 3 boxplots of the data and used:
boxplot(myData1, myData2, myData3)
This worked fine so I consulted R [help(bxp)] to add some format and labels
e.g....
2008 Jul 09
2
Read.table - Less rows than original data
Dear all,
I have problem when reading a table into R. The total row of read in table
has is much less than the original saved table.
I built a 1,273,230 by 6 data set named "mydata2", it was saved in the
following command,
write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t")
The next day I read in above saved text file into R,
temp<-read.table("mydata2.txt",header=T,sep="\t",na.strings="NA")
H...
2007 Mar 08
1
R: Searching and deleting elements of list
you could try mapply
mydata2<-mapply("[", mydata, lapply(mydata, function(x) !x %in% A))
mydata2[[1]]<-A #to replace the obviously deleted elements of "A"
mydata2
mydata2[[1]]
mydata2[[2]]
mydata2[[3]]
mydata2[[4]]
Stefano
-----Messaggio originale-----
Da: r-help-bounces at stat.math.ethz.ch...
2001 Dec 19
2
How to create a data.frame "like" another, but longer?
Hello,
does anyone know of a quick way to create a data frame "like" another, but
with more rows?
What I'd like to do is this:
if mydata is a data.frame like
a b c
1 TRUE yes
2 FALSE no
3 TRUE yes
I'd like to get mydata2 with the same column names and column types, but
without the values and with more rows.
All I could think of was to manually do mydata2 <- maydata, then repeat
mydata2 <- rbind(mydata2, mydata2) until mydata2 is long enough, then cut to
desired length and overwrite with new data. Not exactly...
2010 Aug 05
2
try-error within for loop
...t the moment it is
omitted). So I would expect to get a dataframe with 1000 rows some of
which would be empty, but instead I get a dataframe with 995 rows. In
this case missing 5 rows were omitted.
Any suggestions?
Thanks,
Olga
----------------
result<-list()
for(i in 1:1000)try({
hclass<-mydata2$tclass[mydata2$tspecies%in%com[[i]][[5]][[1]]]
horder<-mydata2$torder[mydata2$tspecies%in%com[[i]][[5]][[1]]]
hfamily<-mydata2$tfamily[mydata2$tspecies%in%com[[i]][[5]][[1]]]
hgenus<-mydata2$tgenus[mydata2$tspecies%in%com[[i]][[5]][[1]]]
hspecies<-mydata2$tspecies[mydata2$tspecies%in%co...
2012 Jul 03
1
insert missing dates
Hello
I have dataframes.
mydata1 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 07:00:00
","2005-05-25 19:00:00","2005-06-25 07:00:00","2005-06-25 19:00:00
","2005-07-25 07:00:00","2005-8-25 19:00:00"))
or
mydata2 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 00:00:00
","2005-05-25 00:10:00","2005-05-25 00:30:00","2005-05-25 00:40:00
","2005-05-25 00:50:00","2005-5-25 01:10:00"))
I have to get such dataframes
mydata1 <-data.fr...
2012 Dec 18
0
R function for computing Simultaneous confidence intervals for multinomial proportions
...z",1:8,sep="")
mydata$pos<-factor(NA,levels=posl)
n=nrow(mydata)
mydata$pos<-replicate(n,sample(posl,1,prob=c(0.05,0.05,0.05,0.4,0.3,0.05,0.05,0.05)))#strong
preference for z3 and z4
##pre-treatment of the above row data, number of time (out of 21) each
position was observed
mydata2=ddply(mydata,.(sub,per,pos),summarize,nobs=length(pos),.drop=F)
mydata2[,1:3]=catcolwise(function(x)as.factor(x))(mydata2)
summary(mydata2)
# boxplot of frequencies of occpupancy
require(ggplot2)
mydata2$fobs=mydata2$nobs/21
ggplot(mydata2)+geom_boxplot(aes(pos,fobs))
###chi2 test
nobsT=ddply(myd...
2009 Jan 06
5
Using apply for two datasets
I can run one-sample t-test on an array, for example a matrix myData1,
with the following
apply(myData1, 2, t.test)
Is there a similar fashion using apply() or something else to run
2-sample t-test with datasets from two groups, myData1 and myData2,
without looping?
TIA,
Gang
2008 Jul 09
1
read.table problem
Dear all,
I have problem when reading a table into R. The total row of read in table
has is much less than the original saved table.
I built a 1,273,230 by 6 data set named "mydata2", it was saved in the
following command,
write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t")
The next day I read in above saved text file into R,
temp<-read.table("mydata2.txt",header=T,sep="\t",na.strings="NA")
H...
2007 Mar 08
1
Searching and deleting elements of list
Hi,
I have a problem. Please, look at example and try to help me!!
> A<-c("aaa","bbb","ccc","ddd","eee")
> B<-c("vvv","ooo","aaa","eee","zzz","bbb")
> C<-c("sss","jjj","ppp","ddd")
> D<-c("bbb","ccc")
2011 Jun 21
5
converting character to numeric
...ase - are all the columns in a database considered "vectors" and that
they can be operated on individually
Therefore I've tried the following
mydata <- as.numeric(mydata$apples)
when i then look at mydata again the named column is still in "character"
format
if i do mydata2 <- as.numeric(mydata$apples)
the new object mydata2 is empty.
Am i missing something about the structure of R?
alina
[[alternative HTML version deleted]]
2013 May 02
0
Data in packages: save or write.table?
Hi all,
I am trying to understand Writing R Extension...
Section 1.1.5, data: I include two datasets in a package, one using 'save',
the other using 'write.table':
--- 8< ----
myData1 <- data.frame(x=1:10)
write.table(myData1,file="myData1.txt")
myData2 <- data.frame(x=2:10)
save(myData2,file="myData2.Rdata")
--- 8< ----
Then R CMD check aks me to document myData1, but does not ask me to document
myData2.
In the R session, after 'library(myPack)', the data 'myData2' is
automatically present in the session while myD...
2008 Apr 15
2
How can I import user-defined missings from Spss?
...------------.
2) Import the Spss Data in R. Via Hmisc or foreign - both work fine.
#import Spssdata in R
spssfile <- "C:/tmp/test.sav"
#via Hmisc
library(Hmisc)
Signs <- c("_")
mydata1 <- spss.get(spssfile,lowernames=TRUE, allow=Signs)
#via foreign
library(foreign)
mydata2 <- read.spss(spssfile,use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE)
#freq in r
describe(mydata1)
describe(mydata2)
*-----------------------------------------------------------------------------------------.
Have a look at the two variables age and sport. In spss the values...
2012 Dec 06
1
Fitting a multinomial model to a multi-way factorial design with repeated measures: help on package and syntax
...05,0.05,0.05)))#strong
preference for z3 and z4
mydata$pos[mydata$pre=="p"]=replicate(n,sample(posl,1,prob=c(0.3,0.4,0.05,0.05,0.05,0.05,0.05,0.05)))#strong
preference for z1 and z2
summary(mydata)
# number of time (out of 21) each position was observed, given hab, pre,
sub and per
mydata2=ddply(mydata,.(hab,pre,sub,per,pos),summarize,nobs=length(pos),.drop=F)
mydata2[,1:5]=catcolwise(function(x)as.factor(x))(mydata2)
summary(mydata2)
# boxplot of frequencies of occpupancy
require(ggplot2)
ggplot(mydata2)+geom_boxplot(aes(pos,I(100*nobs/21)))+facet_grid(pre~hab)
[[alternative...
2006 Nov 09
1
dissimilarity matrices
...ning:
X <- as.dist(Y)
and I can happily now run either hclust(X) or agnes(X).
So that the various bits of output are labelled correctly I would dearly
like to be able to give names to the columns and rows of X, as would happen
if I ran:
mydata<-read.table("clipboard",header=T)
mydata2<-t(mydata)
mydists<-dist(mydata2)
Many thanks for your help.
Best wishes, Kris Lockyear.
2011 Feb 25
1
speed up process
...fv = c(47068.1437773483,
43743.8087431582, 40323.5209129239, 23420.9455581495, 29382.6947428651,
50460.2202192311, 21810.1456510625, 41747.6053810881)), .Names =
c("species", "fruit", "Asfc", "Tfv"), row.names = c(NA, 8L), class =
"data.frame")
mydata2 <- mydata1[!(mydata1$species %in% c("thgel","alsen")),]
mydata3 <- mydata1[!(mydata1$species %in% c("thgel","alsen","poabe")),]
mydata_list <- list(mydata1=mydata1, mydata2=mydata2, mydata3=mydata3)
#function for regression
library(WRS)
fo...
2010 Jan 22
1
confidence intervals for mean (GLM)
...e('treatments'=gl(4,20), 'value'=rpois(80, 1))
model1 <- glm(value ~ treatments, data=mydata1, family=poisson)
means1 <- with(mydata1, tapply(value, treatments, mean))
now I need the confidence intervals for the means
And then again for a negative binomial GLM
require(MASS)
mydata2 <- data.frame('treatments'=gl(4, 4, 64, LETTERS[1:4]), 'species'=gl(4, 1, 64, letters[1:4]), 'value'=rnegbin(64,1,1))
model2 <- glm.nb(value ~ treatments*species, data=mydata2)
means2 <- with(cbind('x'=gl(16,4),mydata2), tapply(value, x, mean))
Can I get th...
2009 Sep 14
1
ggplot2 legend text....a basic question
Hello fellow R's,
I?ve been learning to use the ggplot2 library, and after a full day of
work I still have a couple of basic questions.
Here is an example:
mydata=data.frame(x=runif(20),y=runif(20),n=runif(20))
mydata2=data.frame(x=c(0.4,0.6,0.5),y=c(0.4,0.4,0.6))
ggplot(mydata, aes(x, y)) + geom_point(aes(size = n)) +
geom_polygon(data=mydata2,aes(x,y,alpha=0.5))
In this plot, the points are labeled as "n" (the name of the variable)
and the polygon is labeled as "0.5" (the alpha value us...
2011 Sep 10
0
npreg: plotting out of sample, extremely large bandwidths
...="cv.aic",
data=mydata)
summary(bandwidth)
# perform nonparametric regression using bandwidth
results <- npreg(bws=bandwidth)
summary(results)
# use plot to plot results
plot(results,view="fixed",theta=300)
# example 2: restrict data to observations for which x1>=x2
mydata2 <- mydata[mydata$x1>=mydata$x2,]
# calculate bandwidth
bandwidth2 <- npregbw(formula=y ~ x1 + x2,
regtype="ll",
bwmethod="cv.aic",
data=mydata2)
summary(bandwidth2)
# perform nonparametric regression using bandwidth2
results2 <- npreg(bws=bandwidth...
2011 Feb 28
0
Fwd: Re: speed up process
...fv =
c(47068.1437773483, 43743.8087431582, 40323.5209129239,
23420.9455581495, 29382.6947428651, 50460.2202192311, 21810.1456510625,
41747.6053810881)), .Names = c("species", "fruit", "Asfc", "Tfv"),
row.names = c(NA, 8L), class = "data.frame")
mydata2<- mydata1[!(mydata1$species %in% c("thgel","alsen")),]
mydata3<- mydata1[!(mydata1$species %in% c("thgel","alsen","poabe")),]
mydata_list<- list(mydata1=mydata1, mydata2=mydata2, mydata3=mydata3)
library(WRS)
foo_reg<- function(dat, xva...