Displaying 20 results from an estimated 8000 matches similar to: "How to add elements to a table"
2007 Jul 30
1
correlation and matrix
Dear everyone,
I am new in R and I've got difficulties in realizing the following
tasks:
-I have variables (factors) with different numbers of levels, either 1,
2 or 3.
-I have a matrix containing these 204 factors and I have to correlate
them by groups of 4 variables.
-I have to delete the factors just having one level ( because when
correlating one-level factors, the output is NA)
here
2007 Jun 28
5
Repeat if
Hello,
(Power Book G4, Mac OS X, R 2.5.0)
I would like to repeat the function range for 85 Vectors (V1-V85).
I tried with this code:
i<-0
> repeat {
+ i<-i+1
+ if (i<85) next
+ range (Vi, na.rm = TRUE)
+ if (i==85) break
+ }
I presume that the Vi is wrong, because in this syntax i is not known
as a variable. But I don´t know how to say that it is a variable here.
Would be nice if
2007 Jul 30
8
regular expressions : extracting numbers
Hello all,
I have a vector of character strings, in which I have letters, numbers, and symbols. What I wish to do is obtain a vector of the same length with just the numbers.
A quick example -
extract of the original vector :
"lema, rb 2%" "rb 2%" "rb 3%" "rb 4%" "rb 3%" "rb 2%,mineuse" "rb" "rb" "rb 12"
2007 Feb 02
1
R syntaxe
Hi all,
Suppose I have a vector x with numerical values.
In y, I have a categorial variable : y<-c(1,1,..2,2,...30,30,30)
x and y have the same length.
I would like to compute the mean for x for the modality 1 to 30 in y.
mean(x[y==1]),...,mean(x[y==30])
I do not want to use an iterative procedure such that for (i in 1:30)..
Thanks for your help,
Regards.
Olivier.
--
2010 Jun 09
1
minor tick marks
Hi !
I need a plot for data extending over several orders of magnitude on the y axis.
The following command generates a nice looking semi-log plot for my data:
plot(x,y,log="y",type="l",lty=3, ylim=c(0.01,2),yaxp=c(0.01,1,1),las=1)
I would appreciate having also minor tick marks in-between the 3 major ticks obtained with the above command. The "minor.tick" function
2006 Nov 23
1
how to loop this?
Hi,
I have the next procedure:
t1<-data.frame(table(substr(names(subset(lasker[[1]], lasker[[1]] >=
4)), 1, 7)))
t1[1:5,]
Var1 Freq
1 1988-02 3
2 1988-03 1
3 1988-04 1
4 1988-05 2
5 1988-06 3
How to make a new list?, dataframe? having 189 elements in the 'lasker'
list:
> str(lasker[[1]])
'table' int [, 1:1274] 1 1 3 2 1 5 4 1 1 4 ...
-
2006 Nov 22
3
dataframe manipulation
Hi,
Having a dataframe 'l1' (dput output is below):
>dim(l1)
1274 2
>l1[1:12,]
Var1 Freq
1 1988-01-13 1
2 1988-01-16 1
3 1988-01-20 3
4 1988-01-25 2
5 1988-01-30 1
6 1988-02-01 5
7 1988-02-08 4
8 1988-02-14 1
9 1988-02-16 1
10 1988-02-18 4
11 1988-02-24 2
12 1988-03-04 1
I want to extract the times
2003 Feb 12
4
Interpolation
Dear all,
I have two vectors and connect the points by line segments:
x <- c(1990,1994,1995,1997)
y <- c(30,40,80,20)
plot(x,y,type="l")
I want to get the values of y's on these lines at missing x's,
i.e., at 1991,1992,1993,and 1996. Is there a simple way to do this?
Best regards,
Remigijus mailto:remigijus.lapinskas at maf.vu.lt
2006 Nov 26
1
adding elemens to a list
Hi,
I have a list of 20 elements, each of them of variable length and with a
structure like this:
lasker[[1]][1:10,]
Var1 Freq
1 1988-02 3
2 1988-03 1
3 1988-04 1
4 1988-05 2
5 1988-06 3
6 1988-07 1
7 1988-08 1
8 1988-09 1
9 1989-03 1
10 1989-04 1
How do I can insert in this list:
1988-01 0
1988-10 0
1988-11 0
1988-12 0
1989-01 0
2007 Dec 19
3
plot cummulative sum from calendar time
I have the following list of observations of calendar time:
[1] 03-Nov-1997 09-Oct-1991 27-Aug-1992 01-Jul-1994 19-Jan-1990 12-Nov-1993
[7] 08-Oct-1993 10-Nov-1982 08-Dec-1986 23-Dec-1987 02-Aug-1995 20-Oct-1998
[13] 29-Apr-1991 16-Mar-1994 20-May-1991 28-Dec-1987 14-Jul-1999 27-Nov-1998
[19] 09-Sep-1999 26-Aug-1999 20-Jun-1997 05-May-1995 26-Mar-1998 15-Aug-1994
[25] 24-Jun-1996 02-Oct-1996
2009 Jun 04
3
Understanding R Hist() Results...
Think I'm missing something to understand what is going on with hist(...)
http://n2.nabble.com/What-is-going-on-with-Histogram-Plots-td3022645.html
For my example I count 7 unique years, however, on the histogram there only 6. It looks like the bin to the left of the tic mark on the x-axis represents the number of entries for that year, i.e. Frequency.
I guess it looks like the bin for
2008 Jun 18
4
inverse cumsum
I've a matrix like this:
1985 1.38 1.27 1.84 2.10 0.59 3.47
1986 1.05 1.13 1.21 1.54 0.21 2.14
1987 1.33 1.21 1.77 1.44 0.27 2.85
1988 1.86 1.06 2.33 2.14 0.55 1.40
1989 2.10 0.65 2.74 2.43 1.19 1.45
1990 1.55 0.00 1.59 1.94 0.99 2.14
1991 0.92
2009 Sep 11
1
format (?) problems with data imported from postgres
Good day,
I read some data from a PostgreSQL database by a following script:
library(Rdbi)
library(RdbiPgSQL)
# conn becomes an object which contains the DB connection:
conn <- dbConnect(PgSQL(), host="localhost", dbname="BVS",
user="postgres", password = "*******")
query_duj_kal <- dbSendQuery(conn, "select zdroj as well, cas as date,
fe2,
2013 Mar 14
1
ggplot2 problem
Hello all!
I have a problem with ggplot2 library. I want to do an heat map and the y
variables are the year months. If I use the following code, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2009 May 09
4
Generating a "conditional time" variable
Hi everyone,
Please forgive me if my question is simple and my code terrible, I'm new to
R. I am not looking for a ready-made answer, but I would really appreciate
it if someone could share conceptual hints for programming, or point me
toward an R function/package that could speed up my processing time.
Thanks a lot for your help!
##
My dataframe includes the variables 'year',
2005 Apr 12
2
not plotting when non-existent
R-help,
I'm trying to plot the following:
year lgd
1 1986 136.97479
2 1987 69.10377
3 1988 67.66744
4 1989 71.60316
5 1990 62.06897
6 1992 6.25000
7 1993 27.72021
8 1995 23.83648
9 1996 10.29412
10 1997 95.67487
11 1998 82.09367
12 1999 56.60401
13 2000 29.80864
14 2001 23.77535
15 2002 48.30378
16 2003 83.47571
17 2004 74.58711
There are 2 missing years
2009 Jan 14
1
publication statistics from Web of Science
Dear list,
This is a bit of an off-topic question, but I'm hoping to get some
advice from more experienced people. I've used the website "Web of
Science" to manually collect publication counts responding to several
keywords as a function of date, since the 1960s.
http://apps.isiknowledge.com/RAMore.do?product=UA&search_mode=&SID=P1g9lFJp9 at
2005 Jun 15
4
Multiple line plots
Greetings,
I would like to plot three lines on the same figure, and I am lost. There is
an answer to a similar thread… but I tried matplot and it is beyond me. An
example of the data follows:
Year EM IM BM
1983 9.1 16.8 -7.7
1984 12.0 18.0 -6.0
1985 13.6 19.1 -5.5
1986 12.4 17.3 -4.9
1987 14.6 20.3 -5.7
1988 20.6 23.3 -2.6
1989 25.0 27.2 -2.2
1990 28.4 30.2 -1.8
1991 33.3 31.2 2.1
1992 40.6
2010 Mar 01
1
Generating variable from 2 others in dataframe
Suppose I have the following dataframe called test:
test<-data.frame(year=rep(1990:2003,5),id=gl(5,length(1990:2003)),eif=as.vector(sapply(1:5,function(z){a<-rep(0,length(1990:2003));a[sample(1:length(1990:2003),sample(1:2,1))]<-1;a})))
year id eif
1990 1 0
1991 1 0
1992 1 0
2000 1 1
1994 1 0
1995 1 0
2001 1 0
1997 1 1
....
I want to create a new variable in
2009 Jun 04
3
Getting a column of values from a list - think I'm doing it the hard way
Example code it shown below.
I think I am doing this the hard way. I'm just trying to get the full year value from an array of dates. An example array is shown below. Right now, I'm using a "for" loop to pull the year out of a list where the dates were split up into their individual components.
This seems to work, but just wondering if there is an easier way.
Thanks for