Displaying 20 results from an estimated 1000 matches similar to: "Legend for 2 plots on same screen"
2012 Jun 07
3
conditional statement to replace values in dataframe with NA
Hello and thanks for helping.
#some data
L3 <- LETTERS[1:3]
dat1 <- data.frame(cbind(x=1, y=rep(1:3,2), fac=sample(L3, 6, replace=TRUE)))
#When x==1 and y==1 I want to replace the 1 values with NA
#I can select the rows I want:
dat2<-subset(dat1,x==1 & y==1)
#replace the 1 with NA
dat2$x<-rep(NA,nrow(dat2)
dat2$y<-rep(NA,nrow(dat2)
#select the other rows and rbind
2010 Aug 25
4
degree C symbol in a function
Hello help,
I have changed around some graphing code and made it into a function.
Previously they y label of the axis was inserted as text in its own
layout box.
text(1,1, expression(~degree~C),cex=1)
This worked great and resulted in the symbol for degree.
In the function, I have changed it so:
text(1,1,paste(b_unit),cex=1)
and
b_unit<-expression(~degree~C)
This now inserts ~degree~C
2010 May 18
1
issues with R Library on a Server
Hello,
I am a bit over my head on this issue. My colleagues and I are running
R off of our server. We all have admin rights and prior to yesterday
we all had our own libraries. Our main system administrator advised us
that we should have a shared library. So, I am trying to do this.
I have downloaded the latest version of R and installed it on the
main drive of our server in the "Program
2011 Jun 29
2
Indexing to Insert values from a dataframe into a matrix
Hello,
I think this is a simple problem but I am not coming up with a simple
solution. I think it just an indexing problem.
I can easily replace values in a matrix from a dataframe when the
dataframe has row and column numbers. In the example below I use row
and column names and I can not get it to work
#make a matrix where rows and columns are the lat and long for a
bounding box of Australia
2010 Oct 26
4
divide column in a dataframe based on a character
Hello,
If I have a dataframe:
example(data.frame)
zz<-c("aa_bb","bb_cc","cc_dd","dd_ee","ee_ff","ff_gg","gg_hh","ii_jj","jj_kk","kk_ll")
ddd <- cbind(dd, group = zz)
and I want to divide the column named group by the "_", how would I do this?
so instead of the first row being
x
2010 May 24
2
excluding on element from a list
Dear List,
I am making a list of all the files in a folder and I want to exclude
one file called "proj.current". This is the 31st file in a folder.
Currently I use the command:
tdirs <- list.files(pattern="proj.")[-31]
However I would like to exclude it based on its name and not the position.
Any advice would be useful.
Thanks,
Daisy
Daisy Englert Duursma
Room
2010 Apr 19
2
selecting rows based on number that occurs after letter
Hello,
I am trying to cycle through a csv and make some summary statistics.
I need to select rows based on the number in the row name that comes
after the letter 'y'. For example, ? BA1y1 would equal 1, ?C3A2r3y1
would equal 1 and ?MA3r3y1r3 would equal 1.
I currently have my code ?cycling through by the 5th character but my
rows have variable length and the y can occur in several
2010 Oct 26
2
discerning plot dots using colors
Dear List,
I am using the command plot to present the relationship
between bird richness (Y axis) and elevation (X axis).
However, I would like to observe
the distributions of bird richness in different administrative areas (A, B,
C, …., G) in this plot.
For example, the dots in area A might fall in the upper right part of the
plot, while those in area B might appear in the middle of
2013 Jul 23
2
downloading web content
Hello,
I am trying to use R to download a bunch of .csv files such as:
http://biocache.ala.org.au/ws/occurrences/download?q=Banksia+ericifolia
I have tried the following and neither work:
a<- getURL("
http://biocache.ala.org.au/ws/occurrences/download?q=Banksia+ericifolia")
Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) :
embedded nul in string:
and
2011 Apr 18
4
Deleting the last value of a vector
Hey guys,
I've search a few threads about deleting a value from a vector, but no one
has addressed this question so far.
I want to delete the last value from a string of values
I have:
r = [ 1, 2, 3, 4, 5 ], and i want to make r2 = to [ 1, 2, 3, 4]
So that r2 is just like r, except that it missing the final value.
Thanks,
--
View this message in context:
2011 Feb 07
1
multiple imputation manually
Hi,
I want to impute the missing values in my data set multiple times, and then
combine the results (like multiple imputation, but manually) to get a mean
of the parameter(s) from the multiple imputations. Does anyone know how to
do this?
I have the following script:
y1 <- rnorm(20,0,3)
y2 <- rnorm(20,3,3)
y3 <- rnorm(20,3,3)
y4 <- rnorm(20,6,3)
y <- c(y1,y2,y3,y4)
x1 <-
2011 Oct 31
3
How to use IML with R and SAS
Hello,
I have a for loop that generates data in R. With the IML program, I would
like to analyze data in SAS from each iteration of the for loop in R. It
would be helpful if someone could explain to me how to analyze data this
way.
Thanks
[[alternative HTML version deleted]]
2011 Jan 27
2
identifying when one element of a row has a positive number
Hello,
I am not sure where to begin with this problem or what to search for
in r-help. I just don't know what to call this.
If I have 5 columns, the first 2 are the x,y, locations and the last
three are variables about those locations.
x<-seq(1860,1950,by=10)
y<-seq(-290,-200,by=10)
ANN<-c(3,0,0,0,1,0,1,1,0,0)
CTA<-c(0,1,0,0,0,0,1,0,0,2)
GLM<-c(0,0,2,0,0,0,0,1,0,0)
2010 Sep 30
1
Unix batch to different nodes
Hello,
I am struggling with computing nodes in Unix.
I have the use of a Unix server that has 30 nodes and I would like to
batch scripts.
Here is an R example that results in 72 repeated tasks based on the 2
loops. If I wanted to send these out to the different nodes, each node
has 1 task and the remaining 42 tasks are put in a queue, what would I
do?
#Example:
2011 Aug 08
1
Var-Cov matrix from LMER function
Hello,
Is there a way to get the Var-Cov matrix from the LMER function?
Thanks
[[alternative HTML version deleted]]
2012 Nov 06
2
Append Data to an Excel File through each Iteration of a For Loop
Hi,
I would like to find a way to append data to an excel file through each
iteration of a for loop. Is there a way to use a command such as
write.table and append each iteration to a different sheet?
Thanks
[[alternative HTML version deleted]]
2011 May 20
2
extraction of mean square value from ANOVA
Hello,
I am randomly generating values and then using an ANOVA table to find the
mean square value. I would like to form a loop that extracts the mean square
value from ANOVA in each iteration. Below is an example of what I am doing.
a<-rnorm(10)
b<-factor(c(1,1,2,2,3,3,4,4,5,5))
c<-factor(c(1,2,1,2,1,2,1,2,1,2))
mylm<-lm(a~b+c)
anova(mylm)
Since I would like to use a loop to
2011 Dec 04
1
rnorm command
Hello,
I use the command rnorm, and I feed these results into a lmer command.
Since I am using the rnorm command I expect to get different results for
each iteration, yet for each iteration I am getting the same answer. If
someone understands why I am getting the same answer every time with a
random number generator, I would appreciate help in understanding why this
is happening. Is the lmer
2012 Aug 28
1
write.table and read.table commands
Greetings,
When I try to use the write.table command to save a matrix as a file and
then open the file with read.table, if I try to take the mean of the entire
matrix, instead each column of the matrix has its mean calculated. I have
copied and pasted an example of my code below. When I try to make the
header false with the read.table command, I am given an error message. I
would appreciate any
2010 May 24
1
library location and error messages when loading packages
Hello,
I am running R on a server that several people share. Previously we
all had separate libraries for R.
I have set up R so everyone on the server shares the same library and
I downloaded the latest version of R and installed it on the
main drive of our server in the "Program Files" folder (obvious
enough).
I changed the Environmental Variables in the advanced system setting
so