Displaying 3 results from an estimated 3 matches for "count_1".
Did you mean:
count_p
2007 Feb 20
1
Reshape (pivot) question
...How can I do a new (pivot?) data.frame in R which I can achieve by MS SQL:
select eala,
datepart(month, date) as month,
datepart(year, date) as year,
count(distinct id) as id_count,
count(distinct patient_id) as patient_count,
count(distinct(case when class = 1 then code else null end)) as count_1,
count(distinct(case when class = 2 then code else null end)) as count_2,
count(distinct(case when class = 3 then code else null end)) as count_3,
into temp2
from temp1
group by datepart(month, date), datepart(year, date), eala
order by datepart(month, date), datepart(year, date), eala
I tried s...
2006 Apr 14
0
Calling variables dynamically
...o far
so good.
But the next line of code is designed to find out how many unique values
are in the first column (i.e. number of queries) of the file I just
imported:
assign(paste("res.count",j, sep="_"), NROW(unique(res[j]$V1)))
}
What I expected is a variable named e.g. res.count_1. However, I get an
error:
Error in unique(res[j]$V1) : object "res" not found
How can I dynamically call res1, res2, etc? I've also tried using quotes
and paste, but with no success.
Any help is appreciated.
Andrew Noyes
SCILS
Rutgers University
2006 Apr 14
0
Calling variables dynamically [Broadcast]
...is designed to find out how many
> unique values are in the first column (i.e. number of
> queries) of the file I just
> imported:
>
> assign(paste("res.count",j, sep="_"), NROW(unique(res[j]$V1)))
> }
>
> What I expected is a variable named e.g. res.count_1.
> However, I get an
> error:
> Error in unique(res[j]$V1) : object "res" not found
>
> How can I dynamically call res1, res2, etc? I've also tried
> using quotes and paste, but with no success.
>
> Any help is appreciated.
>
> Andrew Noyes
> SCIL...