Displaying 6 results from an estimated 6 matches for "artificical".
Did you mean:
artificial
2016 Apr 24
2
Inserting a blank row to every other row
Well, something like this would work (there may be slicker solutions):
> z <- data.frame(a=1:3,b = letters[1:3])
> i <- seq_len(nrow(z)) *2
> z <-rbind(z,z)
> z[i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z))
> z
a b
1 1 a
2 NA <NA>
3 3 c
4 NA <NA>
5 2 b
6 NA <NA>
But I agree with you that there is probably a way to handle the
underlying
2009 Mar 03
2
preparing data for barplot()
What is the best way to produce a barplot from my data? I would like
the barplot to show each person with the values stacked
val1+val2+val3, so there is one bar for each person When I use
barplot(data.matrix(realdata)), it shows one bar for each value
instead.
To post here, I created an artificical data set, but it works fine.
fakedata <- as.data.frame(list(LETTERS[1:3]))
colnames(fakedata) <- 'people'
fakedata['val1'] = abs(rnorm(3))
fakedata['val2'] = abs(rnorm(3))
fakedata['val3'] = abs(rnorm(3))
barplot(data.matrix(fakedata))
At a glance there is no...
2016 Apr 24
0
Inserting a blank row to every other row
Oh, sorry, I just realized that I messed up the indicing. Here is the
correct way:
> z <- data.frame(a=1:3,b = letters[1:3])
> i <- seq_len(nrow(z))
> z<-z[rep(i,e=2),]
> z[2*i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z))
> z
Still doubt that this is a good idea, though.
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
2016 Apr 24
0
Inserting a blank row to every other row
Hi Saba,
I don't know how to do what you want and I also cannot see why.
If you describe what you hope to achieve there might be a different
solution.
Best wishes
Ulrik
Saba Sehrish via R-help <r-help at r-project.org> schrieb am So., 24. Apr.
2016 14:04:
> Hi
>
> I need to insert a blank row after every row in R data frame. I have
> achieved it through:
>
>
>
2016 Apr 24
2
Inserting a blank row to every other row
Hi
I need to insert a blank row after every row in R data frame. I have achieved it through:
df[rep(1:nrow(df),1,each=2),]
But it inserts a row with name of previous row, while i want a complete blank row without any name/title.
Please guide me
Regards
Saba
2005 Sep 08
4
Prediction with multiple zeros in the dependent variable
I have a batch of data in each line of data contains three values,
calcium score, age, and sex. I would like to predict calcium scores as a
function of age and sex, i.e. calcium=f(age,sex). Unfortunately the
calcium scorers have a very "ugly distribution". There are multiple
zeros, and multiple values between 300 and 600. There are no values
between zero and 300. Needless to say, the