mfbx9jhy | 20 Apr 17:51 2014
Picon

What do the colours of the scatterplot3d actually show?

Hello, 

Please could anyone tell me the significance of the graded red-black color
when using scatterplot3d? 

At first I thought it was just going from the very 'near' to the back of the
chart area, but as you can see from the pictures some of the points in the
back are bright red. The description from ?scatterplot mentions that
hightlight3d "points will be drawn in different colors related to y
coordinates"... but as you can tell from the plot is isn't true either; with
come short points being black as well as red...

<http://r.789695.n4.nabble.com/file/n4689148/Rplot.png> 

any help would be fantastic, I'm very very new to R

Cheers, 

Jo

--
View this message in context: http://r.789695.n4.nabble.com/What-do-the-colours-of-the-scatterplot3d-actually-show-tp4689148.html
Sent from the R help mailing list archive at Nabble.com.

Pedro Mardones | 20 Apr 06:32 2014
Picon

Replicating SAS example in R

Dear R community;

I'm trying to replicate an example I found on a publication using the
following data

dat <- data.frame(F = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3), T =
c(1,1,1,1,1,1,1,1,2,2,2,
2,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2),
R =
c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,
10,10,10,10,11,11,11,11,12,12,12,12), E =
c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
42,43,44,45,46,47,48), HT =
c(7.3,10.3,14.8,2.9,14.9,1.8,5.1,17.7,14.1,13,19.3,
20.7,24.9,16,14.9,24.9,24.3,28.6,31.8,32.7,29.1,24.7,30.1,31.9,42.2,45.6,40.7,
34.5,38.4,46.4,38,41.7,50.7,53.2,50.1,41.4,53,37.9,50.9,51,69.5,53.8,53.8,62.1,
54.3,63,47,65.4))

F, T are two treatments
R is a row of plants nested within F & T (according to the example)
E are the plants within the rows R

The experimental unit is R but the example considers subsampling, so in
other words, the idea is to use all the data at plant-level (E) for the
analysis instead of the row-level means.

The SAS model used in the example is

(Continue reading)

Andre Zacharia | 20 Apr 11:52 2014
Picon

to divide column cells by the mean of another column

Dear all,

I am getting data columnwise that I need to divide by the mean of another
column

If the column is the previous one this code works perfectly well:

fun1 <- function(beginColumn, by, data) { indx <- seq(beginColumn,
ncol(data), by = by) as.data.frame(t(100 - (t(data[, indx])/colMeans(data[,
indx - 1], na.rm = TRUE)) *  100))
}
(Arun helped me with this code, thank you again!...)

But, the things is now more complicated...

I need to program a function that allow me to divide for example cells from
column 3 on mean from column 2 and cells from column 4 on mean of column 2
and the 5 etc. Then column 6 is another column from whch I  need to extract
the mean and to do the same with column 7 and 8, etc...

so if  I have:

1  2  3 4  1  5
2  5  4 7  2  8
3  4  5 9  3  7
4  7  7 9  4  3

The serie 1,2,3,4 ar just enumerating so not useful at this timepoint.

the results should be (from excel...):
(Continue reading)

arun | 20 Apr 07:36 2014
Picon

Re: Need help to convert data frame to transaction set.


Hi Satish,

Using your code:
part<-read.csv("spares.csv")
str(part)
#'data.frame':    838 obs. of  1 variable:
# $ Cust_ID.Parts: Factor w/ 838 levels "100\tAIR\tFILTER\tHOUSING\t",..: 161 333 495 727 728 768 769 770
784 785 ...

#I guess you have only two columns in the dataset

 lines1 <- readLines("spares.csv")
 head(lines1)
#[1] "Cust_ID\tParts\t\t\t"      "1\tFENDERS\t\t\t"         
#[3] "2\tFENDERS\t\t\t"          "3\tOIL\tFILTERS\t\t"      
#[5] "4\tBMW\tSERVICE\tFLUIDS\t" "4\tOIL\tFILTER\t\t"       

part<-read.csv("spares.csv",header=TRUE,sep="\t")
 str(part)
#'data.frame':    838 obs. of  5 variables:
# $ Cust_ID: int  1 2 3 4 4 5 5 5 6 6 ...
# $ Parts  : Factor w/ 26 levels "AIR","ALTERNATOR",..: 9 9 16 4 16 6 9 12 6 9 ...
# $ X      : Factor w/ 14 levels "","BLADES","CAR",..: 1 1 6 14 5 1 1 1 1 1 ...
# $ X.1    : Factor w/ 6 levels "","(AXLE","CARE",..: 1 1 1 4 1 1 1 1 1 1 ...
# $ X.2    : Factor w/ 2 levels "","BOOT)": 1 1 1 1 1 1 1 1 1 1 ...

part$Parts <- interaction(part[,2:5],sep=" ",drop=TRUE)
 part <- part[,1:2]
 str(part)
(Continue reading)

Suzen, Mehmet | 20 Apr 01:19 2014
Picon

Re: inverse normal distribution function

Not sure how would you do that but there is a package SEM on CRAN for
structural equation models.

On 20 April 2014 01:10, thanoon younis <thanoon.younis80 <at> gmail.com> wrote:
> thank you so much Suzen
> i want to use bayesian analysis in structural equation models with ordered
> categorical data and i want to use inverse normal as a distribution of
> thresholds and i  dont find any paper or documents in R or another program
> about inverse normal.
>
> best regards
>

Brian Willis | 19 Apr 17:51 2014
Picon
Picon

Extracting the names of coefficients of random effects

Hi All,
I need to be able to manipulate the names of the coefficients from
*ranef()*.

If there is any missing data when fitting a mixed model using lmer, no
estimate is returned for the associated level for that random effect. Thus
if the data input for regions had levels 
	*Region*
        Bolton
	Bradford                              	         				                                	  
        Cambridge		                                                 
        Durham						 
and there was missing data on Bradford then 
* ranef(model)*					gives 
	                                                     (Intercept)
Bolton:                               	          -0.0981763413
Cambridge		                                   0.0151102347
Durham						   0.1837142259

This becomes a problem if I want to use *predict( )* on new data where there
is no missing data on Bradford. In such an instance

	*predict (model, newdata = newInput) *	gives the following error message 

             ‘Error in (function (x, n)  : new levels detected in newdata’

I could get round this by checking the Region field of the new data
‘newInput’ against the names of the levels of the intercept coefficients
from* ranef().*
However, I’m not sure how to access these since if 
(Continue reading)

Francesco Brundu | 19 Apr 12:05 2014
Picon

How to use rainbow function without the gamma argument

Hi all,
I am using an old code (probably written for R 2.5) and it stops when
calling rainbow() with gamma argument. I saw that gamma argument is not
present in newer version of R rainbow function. How can I translate this
line of code:

rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5)

?

It fails with:

Error in rainbow(100, s = 1, v = 0.75, start = 0, end = 0.75, gamma = 1.5)
:
  unused argument (gamma = 1.5)
Calls: nmfconsensus ... matrix.abs.plot -> image -> image.default -> rainbow
Execution halted

Thanks

~ Francesco Brundu

	[[alternative HTML version deleted]]

burak ömer saraçoglu | 19 Apr 11:10 2014
Picon

R Statistical Computing Language Preference Help


Dear R Developers and Help Specialists; 
I downloaded and installed R to learn and use it during solutions of my scientific studies.
At first, I got in trouble with it with the menu languages. It is in Turkish and I have to change it to English
but I can not find where the language preferences menu or options menu is.
Could you please let me know how I can select the English Language as the main language of the software (for
menus, help etc.)
Your kindness and help will be very much appriciated.
Please do not publish on web my e-mail. 
Have a nice day.
Best Regards
Dr. Burak Omer Saracoglu
PhD in Graduate School of Science Engineering and Technology
MSc in Industrial Engineering
BSc in Naval Architecture and Marine Engineering

            
 		 	   		  
	[[alternative HTML version deleted]]

Sathish Kumar | 19 Apr 10:57 2014
Picon

Need help to convert data frame to transaction set.

Hi,

To convert coerce the data set to transaction data set I used the code

trans4 <- as(split(a[,"Cust_ID"], a[,"Parts"]), "transactions")

but I am getting the following error-

Error in as(split(a[, "Cust_ID"], a[, "Parts"]), "transactions") : nomethod
or default for coercing “list” to “transactions”

Then I tried first converting the data set to matrix structure using the
code

c_m<-as.matrix(c_df)
 c_m

then entered the following code

trans2 <- as(c_m, "transactions")

but got the following error

Error in as(c_m, "transactions") : no method or default for coercing
“matrix” to “transactions”
Please let me know how to correct the problem.

Thanks
Sathish
(Continue reading)

Philip Robinson | 19 Apr 22:25 2014
Picon

cex values being ignored in the curve function

Dear R-Community,

The cex values in curve seem to be being ignored. I have searched 
previous help questions and also the web generally, and cannot find this 
being a major problem so I am suspicious of something odd happening but 
I am at a loss to work out why.

I am trying to plot this:

b1      <- -0.858
pow    <- 0.8
ratio   <- 1
sig      <-
0.05

curve((qnorm(1-sig/2)+qnorm(pow))^2/b1^2/x/(ratio/(1+ratio))/(1/(1+ratio)),from=0.005,to=0.08,main="This 
needs to be bigger",xlab="And this bigger too",ylab="And this too", 
cex=1,cex.lab=3.5, cex.axis=3.5, cex.main=3.5, cex.sub=3.5)

But no matter what value of cex I make it, or whether I break up the 
arguments into :

title(main="something",cex.main=3)
axis(cex.axis=2)

or parse this before plotting : par(cex.lab=1.5, cex.axis=1.5, 
cex.main=3.5, cex.sub=1.5)

I cannot get the main, axis titles or axis numbers to change in size, 
whatever I do.
(Continue reading)

arun | 19 Apr 19:40 2014
Picon

Re: cbind with row names to serveral files in R

Hi,
The rownames part is not clear as your expected output and input files didn't show them as rownames. 

##Suppose you have all the files in a folder
##here I am creating the names of those files

files1 <- paste0("sample", rep(1:777, each=29),"chr",1:29,".txt")
length(files1)
#[1] 22533
lst1 <-  split(files1,as.numeric(gsub(".*chr(\\d+)\\..*","\\1",files1)))

##use list.files() 

##in your case, ##not tested

lst1 <- split(list.files(pattern="sample\\d+"),
as.numeric(gsub(".*chr(\\d+)\\..*","\\1",list.files(pattern="sample\\d+")))) ##in case other
files are also in the folder

library(plyr)

lst2 <- lapply(lst1,function(x) {x1 <-join_all(lapply(x,function(y)
read.table(y,header=TRUE,stringsAsFactors=FALSE,sep="")),c("Name","Chr","Position")) })

lapply(seq_along(lst2),function(i) write.table(lst2[[i]],paste0("LRRrawallchr",i,".txt"),row.names=FALSE,quote=FALSE))

###if you need to create rownames using the first three columns:
lapply(seq_along(lst2),function(i) {x1 <- lst2[[i]]; row.names(x1) <-
as.character(interaction(x1[,1:3],sep="_")); x2 <- x1[,-(1:3)]; write.table(x2,
paste0("LRRrawallchr",i,".txt"), quote=FALSE)})
(Continue reading)


Gmane