Displaying 20 results from an estimated 1200 matches similar to: "How should i change the SAS Codes into R Codes?"
2012 Oct 04
1
R help - Adding a column in a data frame with multiple conditions
Hi,
I am trying to add a column of numbers to a data frame in R with multiple
conditions.
Here is a simplified example df:
[A] [B] [C] [D] [E]
[1] 1 X 90 88
[2] 1 Y 72 70
[3] 1 Z 67 41
[4] 2 X 74 49
[5] 2 Y 42 50
[6] 2 Z 81 56
[7] 3 X 92 59
[8] 3 Y 94 80
[9] 3 Z 80 82
I would like column [E] to have a certain value (found either in [C] or
[D]) based on conditions in columns [A] *and* [B].
2011 Jun 17
4
profile plot in R
Hi friends,
I have a matrix with following format.
group var1 var2 .......varN
c1 group1 1.2399 1.4990....-1.4829
c2 group4 0.8989 0.7849.....1.8933
...
...
c100 group10 .....
I want to draw a profile plot
of each condition c1 to c100, which rows in above matrix and each line
representing a row should be uniquely colored according to the group(1
to 10).
I think this is simple task
2009 Dec 31
4
Obtaining partial output from a function that does not run to completion.
I have written a function that contains runs
lm()
vif() and
glm()
When the glm() blows up with an error message, I don't get the output from either the lm() or vf() even thought neither lm() nor vif() have any problems . How can I force the function to print sequential results rather than wait for the entire function to complete before listing the functhion's output?
Thanks,
John
2013 Jun 06
2
generating a bar chart with two axis for co-linear variable
Hello Dimitris,
I was goggling for some help on Sensitivity vs 1-specificity and saw your link.
I hope you can be of help to me in one of the issue that I am facing in generating combo chart(bar chart and plot). I am a novice and have some difficulty in getting this logic correct.
I am give a dataset (I am attaching a sample dataset).
I am using a barplot() and passing values for
2006 Dec 07
2
How to use read.xls in R
Hello there,
In gdata package, read.xls is to be used for reading excel data (from
windows).
The following is my code:('C:/session/sampledata.xls' is where the file
is stored)
data1<-read.xls('C:/session/sampledata.xls',sheet=1)
and I got the following error message:
Error in system(cmd, intern = !verbose) : perl not found
Could you please tell me what I have done wrong and
2009 Jan 17
4
Where to find the source codes for the internal function in stats package
Dear all,
I want to see the source codes for "dchisq(x, df, ncp=0, log = FALSE)",
but cannot find it.
I input "dchisq" in the R interface, and then enter, the following message
return:
> dchisq
/*****************************************************/
function (x, df, ncp = 0, log = FALSE)
{
if (missing(ncp))
.Internal(dchisq(x, df, log))
else
2010 Jan 02
1
Help with tryCatch
Windows XP
R 2.8.1
Colleagues,
I am trying to run a function testone() and if the function completes without error do one set of instructions, and if the function generates either a warning or an error run another set of instructions. I have read try, and tryCatch help screens at least 20 times, have tried to experiment with code, but I can't understand how to accomplish my desired task.
2009 Oct 09
2
Creating a Clustered-Stacked Column Chart
Hi all,
In R, is there some functions or ways to create a Clustered-Stacked
Column Chart as the example in the following page
http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html?
I have browsed the R Graph Gallery (http://addictedtor.free.fr/graphiques/)
and searched the R site, and didnot find an appropriate method to do it.
Anybody has met this problem before?
Thanks a lot.
2009 Nov 25
2
Grouped Barplot
Hi R Users,
I tried plotting a similar boxplot as it is on the FOLLOWING LINK:
http://www.imachordata.com/wp-content/uploads/2009/09/boxplot.png
Sample data is attached -- there are 9 years and 5 cities. In my case I'm
looking to plot "Year" on x-axis and grouping boxplots by "City". I tried
the following code.
foo<-read.table("SampleData.csv",
2003 Jun 25
1
Help on using read.table with files containing dates
I am a relatively new user of R and have a question about using the
read.table command for reading in .csv files that contain dates. My
ultimate goal is to be able to read several different files into data frames
and then do a merge along the "Date" column of each data frame. It seems I
should be able to specify the name of the column that contains dates and
then automatically convert
2002 Jul 12
2
Lattice help (again?)
I appologize if this post is a duplicate, but I did not get my first
post myself..
Here is my original post:
---------------------------------
Hi all,
I've got some troubles with a Lattice plot. The error I get is
Error in Ops.factor(groups[subscripts], vals[i]) :
Level sets of factors are different
which sort of doesn't make sense to me. Can you please help me
figure out what
2007 Aug 17
3
Is there any good tools to facilitate us to create R functions?
Dear R users,
We have some programs for the specific task in our research, but they were
very commonly used. We want to make some functions for them, anybody can
recommend any good tools to facilitate us to create R functions even without
going deep into the theories of R functions ?
Any suggestions or help are greatly appreciated.
--
With Kind Regards,
oooO:::::::::
(..):::::::::
2007 Jun 25
7
R-excel
Good morning to everybody,
I have a problem : how can I import excel files in R???
thank you very much
Dr.sa. Erika Frigo
Università degli Studi di Milano
Facoltà di Medicina Veterinaria
Dipartimento di Scienze e Tecnologie Veterinarie per la Sicurezza Alimentare (VSA)
Via Grasselli, 7
20137 Milano
Tel. 02/50318515
Fax 02/50318501
[[alternative HTML version deleted]]
2010 Mar 10
3
see the example and help me
sample report data that i want to forecast
quarter quarter_index Revenue
2007 Q1 1 $3,856,799
2007 Q2 2 $4,243,328
2007 Q3 3 $4,930,369
2007 Q4 4 $5,443,579
2008 Q1 5 $5,164,830
2008 Q2 6 $5,104,413
2008 Q3 7
2006 Apr 13
2
a question on subset a dataset
Dear R-users,
I generate a dataset "d", and want to get a subset from it.
**
*z<-rnorm(9)
coords<-cbind(x=c(1,1,1,2,2,2,3,3,3),y=c(1,2,3,1,2,3,1,2,3))
d<-SpatialPointsDataFrame(coords, data.frame (z=z[1:9]))*
The result*/dataset* is
coordinates z
1 (1, 1) 1.41173570
2 (1, 2) 0.18546503
3 (1, 3) -0.04369144
4 (2, 1) -0.21591338
5 (2, 2)
2009 Jul 29
2
cannot allocate a vector with 1920165909 length
Dear Rusers,
The error for the following was that it cannot allocate the vector of
length 1920165909.
a <- expand.grid(se1=0:100/100, sp1=0:100/100, se2=0:100/100, sp2=0:100/100,
DR=0:100/100)
How to solve it? Maybe setwd(dir) can, i am not very sure about it.
Any ideas about it?
[[alternative HTML version deleted]]
2007 Oct 02
2
How to add legend for image()?
Dear friends,
The following is an example to explain my question. I want to get a
legend which will show the z-values according to different colors in image()
function.
x<-sort(runif(10)) #x-coordinates
y<-sort(runif(10)) #y-coordinates
z<-matrix(runif(100),nrow=10) #attributes values
image(x,y,z,col=gray((6:3)/6))
# legend(x,y,legend=z,col=gray((6:3)/6)) #error. the colors should
2007 Jan 30
2
R and S-Plus got the different results of principal component analysis from SAS, why?
Dear Rusers,
I have met a difficult problem on explaining the differences of principal
component analysis(PCA) between R,S-PLUS and SAS/STATA/SPSS, which wasn't
met before.
Althought they have got the same eigenvalues, their coeffiecients were
different.
First, I list my results from R,S-PLUS and SAS/STATA/SPSS, and then show
the original dataset, hoping sb. to try and explain it.
2008 Sep 23
3
Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?
Dear R users,
I hope to explain the concepts of skewness and kurtosis by generating
series of distributions with same skewness and different kurtosis or with
same kurtosis and different skewness, but it seems that i cannot find the
right functions.
I have searched the mailing list, but no answers were found.
Is it possible to do that in R? Which function could be used?
Thanks a lot.
--
2006 Nov 07
1
plot questions?-errors in persp(x1, x2, y) and contour(x1, x2, y)
Dear Uwe Ligges ,
I still can't finish it.
*> aa* #my data
x1 x2 y
5 0.05 6 4.4180
1 0.50 3 2.6979
4 0.50 9 2.9000
7 0.95 6 2.6230
8 0.95 6 2.9078
9 0.95 6 2.6727
3 1.40 3 2.4203
2 1.40 9 2.5329
6 1.85 6 2.4867
*> attach(aa)*
*> persp(x1,x2,y*
error in persp.default(x1, x2, y) : increasing 'x' and 'y' values expected